# GATE - 2020 | OS | Consider the following set of processes, assumed to have arrived at time 0.

## Question:

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

## Solution:

### Shortest Job First

Therefore, Average Turn Around Time (TAT) is,

= {(21 – 0) + (13 – 0) + (2 – 0) + (6 – 0)} / 4
= 10.5 

### Round Robin with TQ (4 ms)

Therefore, Average Turn Around Time (TAT) is,

= {(18 – 0) + (21 – 0) + (10 – 0) + (14 – 0)} / 4
= 15.75

Hence,

= ⏐SJF (TAT) – RR(TAT)⏐
= ⏐10.5 – 15.75⏐
= 5.25 
Thank You