What is the turnaround time of each process for each of the scheduling algorithms in part (a).
The Gantt-chart for FCFS scheduling is
P1 P2 P3 P4 P5
0 1 2 4 5
10
Turnaround time = Finished Time – Arrival Time Turnaround time for process P1 = 1 – 0 = 1 Turnaround time for process P2 = 2 – 0 = 2 Turnaround time for process P3 = 4 – 0 = 4 Turnaround time for process P4 = 5 – 0 = 5 Turnaround time for process P5 = 10 – 0 = 10 Average Turnaround time = (1+2+4+5+10)/5 = 4.4 The Gantt-chart for SJF scheduling is
P1 P2 P4 P3 P5
0 1 2 3 5
10
Turnaround time for process P1 = 1 – 0 = 1 Turnaround time for process P2 = 2 – 0 = 2 Turnaround time for process P3 = 5 – 0 = 5 Turnaround time for process P4 = 3 – 0 = 3 Turnaround time for process P5 = 10 – 0 = 10
Average Turnaround time = (1+2+5+3+10)/5 = 4.2 The Gantt-chart for Priority scheduling is
P1 P2 P5 P3 P4
0 1 2 7
9 10
Turnaround time for process P1 = 1 – 0 = 1 Turnaround time for process P2 = 2 – 0 = 2 Turnaround time for process P3 = 9 – 0 = 9 Turnaround time for process P4 = 10 – 0 = 10 Turnaround time for process P5 = 7 – 0 = 7 Average Turnaround time = (1+2+9+10+7)/5 = 5.8 The Gantt-chart for RR scheduling is
P1 P2 P3 P4 P5 P3 P5
0 1 2 3 4 5 6
10
Turnaround time for process P1 = 1 – 0 = 1 Turnaround time for process P2 = 2 – 0 = 2 Turnaround time for process P3 = 6 – 0 = 6 Turnaround time for process P4 = 4 – 0 = 4 Turnaround time for process P5 = 10 – 0 = 10 Average Turnaround time = (1+2+6+4+10)/5 = 4.8
