II. Threads (20 points)
a. What resources are shared among different threads in a multithreaded process? (10 points)
b. Describe two differences between user-level and kernel-level threads. In what circumstances is one better than the other? (10 points)
III. CPU Scheduling (20 points)
Process Information.
Process Burst Time Priority Arrival Time
P1 15 2 0
P2 9 1 4
P3 6 5 8
P4 10 4 12
P5 4 3 16
Consider the processes described in Table 1. Higher priority numbers indicate higher-priority processes (e.g., priority 5 is higher than priority 1)
Questions: What is the average turnaround time of these processes for each of the following scheduling algorithms? (Draw a Gantt chart for each algorithm.)
a. First Come First Serve (FCFS)
b. Non-preemptive Shortest Job First (NP-SJF)
c. Preemptive Shortest Job First (P-SJF, or STCF)
d. Preemptive Priority Scheduling
e. Round Robin, with the following assumptions:
1. The scheduling time quantum is 4 time units
2. If a new process arrives at the same time as the time slice of the executing process expires, the OS puts the executing process at the end of the ready queue after the new process.