Due: Monday 3rd Mar. 2003, 23:30
a) What are two differences between user-level threads and kernel-level threads?
b) Under what circumstances is one type better than the other?
a) Describe the actions taken by a kernel to context-switch between processes.
b) Describe the actions taken by a kernel to context switch between kernel-level threads.
c) Describe the actions taken by a thread library to context switch between user-level threads.
a) What resources are used when a thread is created?
b) How do they differ from those used when a process is created?
a) Define the difference between preemptive and non-preemptive scheduling.
b) Explain why strict non-preemptive scheduling is unlikely to be used in a computer center.
5. What is the effect on the Round Robin Algorithm of
increasing the time slice to
arbitrarily large values?
6. Suppose that the following processes arrive for execution at the
Each process will run the listed amount of time. In answering the questions, use
non-preemptive scheduling with zero context switch overhead and base all decisions
on the information that you have at the time the decision must be made.
a) What is the average turnaround and waiting time for these processes
FCFS scheduling algorithm?
b) What is the average turnaround and waiting time for these processes
SJF scheduling algorithm?
c) The SJF algorithm is supposed to improve performance, but notice
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 are waiting during this idle time, so their waiting time may increase.
This algorithm could be known as future-knowledge scheduling.
d) In the above problem assume a three level MLFQ; a process
can execute in
the first level for 1 time unit, in the second level for 2 time units and in the third level
for 4 time units. Calculate the average turnaround and waiting times for each of the
7. What advantage does the test&set instruction have over enabling
interrupts? In which circumstance may we still prefer enabling and disabling
8. Semaphores. Suppose a building has a limit on the number
of people that may be in the building at one time due to a fire code.
Suppose this is a very popular place to visit, so the number of people
inside must be monitored closely. Further, suppose that this building
has N entrances and M exits. Construct an algorithm that could be
used to control a set of turnstiles that would ensure that 1) only one
person can enter or exit through a particular door at any one time,
and 2) the room is allowed to be filled but is never allowed to exceed
its legal capacity. Note that multiple people may pass through
different doors simultaneously. Specifically, write pseudo code for
the following two methods and for the initialization of the necessary
where j is a value between 1 and M (you can assume that the value is legal). This method returns when the calling thread has successfully left through door j.
9. How much time did you spend on this assignment?
Last modified: Sat Feb 15 01:42:59 EST 2003