GATE CS 2020 CPU Scheduling PYQ

GATE 2020

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

Processes

P1

P2

P3

P4

Burst time (in ms)

8

7

2

4

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

Shortest Job First (SJF)

Process

Burst Time

Completion Time

Turn Around Time

P1

08

21

21

P2

07

13

13

P3

02

02

02

P4

04

06

06

Average Turn Around TIme (21+13+2+6)/4 = 10.5
Round Robin (RR)

Process

Burst Time

Completion Time

Turn Around Time

P1

08

18

12

P2

07

21

21

P3

02

10

10

P4

04

14

14

Average Turn Around Time (18+21+10+14)/4 = 15.75
Absolute value of the difference = | 10.75 – 15.75 | =5.25