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 P1, P2, P3, P4.

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_______.

Correct Answer:

5.25

Solution:

For RR: Processes are scheduled in order P1, P2, P3, P4
Time quantum = 4ms

ProcessATBTCTTAT = CT - AT
P1081818
P2072121
P3021010
P4041414

Avg. TAT = 18+21+10+144= 634 = 15.75ms

For SJF:

ProcessATBTCTTAT = CT - AT
P1082121
P2071313
P30222
P40466

Avg. TAT = 21+13+2+64=424=10.5 ms

Absolute value of the difference between the average TAT of SJF and RR

= | 15.75 - 10.5 |= 5.25 ms