The GATE Grind

GATE 2020 CS – Question 60

Operating System · CPU and I/O Scheduling · 2 marks · Numerical answer

Consider the following set of processes, assumed to have arrived at time 0. Consider the CPU scheduling algorithms Shortest Job First (SJF) and Round Robin (RR). For RR, assume that the processes are scheduled in the order $P_1,P_2,P_3,P_4$.

Burst times (in ms): $P_1=8$, $P_2=7$, $P_3=2$, $P_4=4$

If the time quantum for RR is 4 ms, then the absolute value of the difference between the average turnaround times (in ms) of SJF and RR (round off to 2 decimal places) is ______.

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: 5.25 to 5.25

Explanation

SJF order P3, P4, P2, P1 gives completion times 2, 6, 13, 21, so average = 10.5. RR (q=4) gives completion times P1=18, P2=21, P3=10, P4=14, so average = 15.75. Difference = 5.25.