OS Final Fall'19 Solution
OS Final Fall'19 Solution
P0 P2 P3 P0 P4 P1
0 4 9 13 19 31 46
P0 P1 P2 P3 P4 P0 P1 P4 P1 P4
0 5 10 15 19 24 29 34 39 44 46
Q3 (b): Calculate the average waiting time and the average turnaround time for each
of the scheduling algorithms mentioned in (a) above. (8)
SJF Round-Robin
Process Turn-around Waiting time Turn-around Waiting time
P0 19 – 0 = 19 19 – 10 = 9 29 – 0 = 29 29 – 10 = 19
P1 46 – 2 = 44 44 – 15 = 29 44 – 2 = 42 42 – 15 = 27
P2 9–4=5 5–5=0 15 – 4 = 11 11 – 5 = 6
P3 13 – 6 = 7 7–4=3 19 – 6 = 13 13 – 4 = 9
P4 31 – 8 = 23 23 – 12 = 11 46 – 8 = 38 38 – 12 = 26
Q3 (c): Using preemptive priority-based scheduling, give the Gantt chart and
calculate the average waiting time for the following priorities where 1 is the highest
priority: (8)
P0 = 5; P1 = 3; P2 = 6; P3 = 4; P4 = 1
P0 P1 P4 P1 P3 P0 P2
0 2 4 6 8 20 29 33 41 46