You are on page 1of 3

4.

2 Using Amdahl’s Law, calculate the speedup gain of an application that has a 60 percent parallel
component for (a) two processing cores and (b)four processing cores.

4.3 Does the multithreaded web server described in Section 4.1 exhibit task or data parallelism?

Task – multiple tasks doing different things,

Data – each request

4.4 What are two differences between user-level threads and kernel-level threads? Under what
circumstances is one type better than the other?

User-level threads are supported at the user level, above the kernel and are managed without kernel
support; because they are implemented by users the kernel is not aware of their existence.

Kernel threads are supported and managed directly by the operating system. Since they are handled by
operating system the kernel does the thread management.

Generally a kernel thread is more appropriate for higher-priority task which need system resources
while the user threads are more appropriate for lower-level task which do not need to be necessarily
managed by the kernel.

4.6 What resources are used when a thread is created? How do they differ from those used when a
process is created?

When a thread is created, register set, stacks and private storage area are created which are the context
of the thread,

- A thread set is the storage location for storage during context switching,
- A local stack recorded the procedure call arguments, return values and return address and,
- Thread-private storage is used by various run-time libraries and dynamic link libraries.
4.7 Assume that an operating system maps user-level threads to the kernel using the many-to-many
model and that the mapping is done through LWPs. Furthermore, the system allows developers to
create real-time threads for use in real-time systems. Is it necessary to bind a real-time thread to an
LWP? Explain.

Yes, it is necessary to bind a real-time thread to an LWP, this ensures the thread will be able to run with
minimal delay time once it is scheduled. For real-time systems, time is critical. If a thread is identified as
real-time but it is not bound to LWP, the thread may have to wait to be attached to an LWP before
running.

5.1 A CPU-scheduling algorithm determines an order for the execution of its scheduled processes. Given
n processes to be scheduled on one processor, how many different schedules are possible? Give a
formula in terms of n.

It is possible to schedule process on n!

5.2 Explain the difference between preemptive and nonpreemptive scheduling.

New processes coming can interrupt the other process from execution in preemptive scheduling while in
non preemptive scheduling cannot be interrupted

Preemptive scheduling is flexible but it is also cost-associated and it has overheads.

Non-preemptive scheduling does not have overheads but it is not flexible and it is not cost-associated

5.3 Suppose that the following processes arrive for execution at the times indicated. Each process will
run for the amount of time listed. In answering the questions, use non-preemptive scheduling, and base
all decisions on the information you have at the time the decision must be made.

a. What is the average turnaround time for these processes with the FCFS scheduling algorithm?

((0 + 8) + (7.6 + 4) + (11+ 1) ) / 3 = 10.5333

b. What is the average turnaround time for these processes with the SJF scheduling algorithm?

((0 + 8) + (8.6 + 4) + (7+ 1) ) / 3 = 9.5333

c. The SJF algorithm is supposed to improve performance, but notice that we chose to run process P1 at
time 0 because we did not know that two shorter processes would arrive soon. Compute what the
average turnaround time will be if the CPU is left idle for the first 1 unit and then SJF scheduling is used.
Remember that processes P1 and P2 are waiting during this idle time, so their waiting time may
increase. This algorithm could be known as future-knowledge scheduling.

((6 + 8) + (1.6 + 4) + (0+ 1) ) / 3 = 6.866


5.6 What advantage is there in having different time-quantum sizes at different levels of a multilevel
queueing system?

Process that need more frequent servicing, for instance, interactive process such as editors can be in a
queue with a small time quantum.

Process with no need for frequent servicing can be in a queue with a larger quantum, requiring fewer
context switches to complete the processing, and thus making more efficient use of the computer.

You might also like