Skip to content
Official PYQ · 2020

GATE CS 2020 Q50 — CPU Scheduling

Explain with AI
Consider the following set of processes, assumed to have arrived at time 00. Consider the CPU scheduling algorithms Shortest Job First (SJF) and Round Robin (RR). For RR, assume that the processes are scheduled in the orderP1,P2,P3,P4P_1, P_2, P_3, P_4.

ProcessesP1P2P3P4Burst time (in ms)8724\begin{array}{|l|l|l|l|l|} \hline \text{Processes} & P_1 & P_2 & P_3 & P_4 \\ \hline \text{Burst time (in ms)} &8 & 7 & 2 & 4 \\ \hline \end{array}

If the time quantum for RR is 44 ms, then the absolute value of the difference between the average turnaround times (in ms) of SJF and RR  (round off to 22 decimal places is_______
View worked solution

Answer: 5.25:5.26

Since all processes arrive at time t=0t = 0, the turnaround time (TAT) for each process is equal to its completion time (CT).

1. Shortest Job First (SJF) Scheduling

Sorting the processes by burst time: P3 (2)P_3\ (2), P4 (4)P_4\ (4), P2 (7)P_2\ (7), P1 (8)P_1\ (8).

  • Gantt Chart: | P3 (0-2) | P4 (2-6) | P2 (6-13) | P1 (13-21) |
  • Turnaround times: P1=21P_1 = 21, P2=13P_2 = 13, P3=2P_3 = 2, P4=6P_4 = 6
  • Average TATSJF=21+13+2+64=424=10.5 ms\text{TAT}_{\text{SJF}} = \frac{21 + 13 + 2 + 6}{4} = \frac{42}{4} = 10.5\text{ ms}

2. Round Robin (RR) Scheduling (Quantum = 4 ms)

Processes are scheduled in the order P1,P2,P3,P4P_1, P_2, P_3, P_4:

  • 0−40 - 4: P1P_1 runs (remaining burst = 44)
  • 4−84 - 8: P2P_2 runs (remaining burst = 33)
  • 8−108 - 10: P3P_3 runs (finishes at 1010)
  • 10−1410 - 14: P4P_4 runs (finishes at 1414)
  • 14−1814 - 18: P1P_1 runs (finishes at 1818)
  • 18−2118 - 21: P2P_2 runs (finishes at 2121)
  • Turnaround times: P1=18P_1 = 18, P2=21P_2 = 21, P3=10P_3 = 10, P4=14P_4 = 14
  • Average TATRR=18+21+10+144=634=15.75 ms\text{TAT}_{\text{RR}} = \frac{18 + 21 + 10 + 14}{4} = \frac{63}{4} = 15.75\text{ ms}

3. Absolute Difference

Difference=∣10.5−15.75∣=5.25 ms\text{Difference} = |10.5 - 15.75| = 5.25\text{ ms}

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore CPU Scheduling questions