CPU Scheduling Template
Part 1:
Consider the following set of processes, with the length of the CPU burst given in milliseconds:
Process Burst Time Priority
P1 2 2
P2 1 1
P3 8 4
P4 4 2
P5 5 3
The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0.
Draw four Gantt charts that illustrate the execution of these processes using the following scheduling algorithms: FCFS, SJF, nonpreemptive priority (a larger priority number implies a higher priority), and RR (quantum = 2)
What is the turnaround time of each process for each of the scheduling algorithms in part a?
Turnaround Time
Process FCFS RR SJF Priority
P1
P2
P3
P4
P5
What is the waiting time of each process for each of these scheduling algorithms?
Waiting Time
Process FCFS RR SJF Priority
P1
P2
P3
P4
P5
d. Calculate the average waiting time for each algorithm in part-c above. (To receive full credit, you must show your calculations.)
FCFS:
RR:
SJF:
Priority:
Part 2:
The following processes are being scheduled using a preemptive, round-robin scheduling algorithm. Each process is assigned a numerical priority, with a higher number indicating a higher relative priority. In addition to the processes listed below, the system also has an idle task (which consumes no CPU resources and is identified as Pidle ). This task has priority 0 and is scheduled whenever the system has no other available processes to run. The length of a time quantum is 10 units. If a process is preempted by a higher-priority process, the preempted process is placed at the end of the queue.
Thread Priority Burst Arrival Turnaround
Time Waiting
Time
P1 40 20 0
P2 30 25 25
P3 30 25 30
P4 35 15 60
P5 5 10 100
P6 10 10 105
Complete the table above by calculating the turnaround time and waiting time for each process.
What is the CPU utilization rate? (show your calculations)
Answer: ____________________________