Question

Processes P1,P2,P3,P4P_1, P_2, P_3, P_4 arrive in that order at times 0, 1, 2, and 8 milliseconds respectively, and have execution times of 10, 13, 6, and 9 milliseconds respectively. Shortest Remaining Time First (SRTF) algorithm is used as the CPU scheduling policy. Ignore context switching times.

Which ONE of the following correctly gives the average turnaround time of the four processes in milliseconds?

Choose one option
Official answer and solution
Official answer
D
From
Official GATE 2025 answer key

Solution

Construct the Gantt chart for SRTF scheduling, compute each process's completion time and turnaround time (TAT=CT−AT\text{TAT} = \text{CT} - \text{AT}), and take the average.

Tracing the SRTF schedule:

  • t=0t = 0 to 11: P1P_1 runs (9 ms9\text{ ms} remaining). At t=1t = 1, P2P_2 arrives with burst 13>913 > 9, so P1P_1 continues.
  • t=1t = 1 to 22: P1P_1 runs (8 ms8\text{ ms} remaining). At t=2t = 2, P3P_3 arrives with burst 6<86 < 8 and preempts P1P_1.
  • t=2t = 2 to 88: P3P_3 runs to completion at t=8t = 8. At t=8t = 8, P4P_4 arrives with burst 99.
  • t=8t = 8 to 1616: Remaining times are P1=8,P4=9,P2=13P_1 = 8, P_4 = 9, P_2 = 13. P1P_1 runs to completion at t=16t = 16.
  • t=16t = 16 to 2525: P4P_4 (9<139 < 13) runs to completion at t=25t = 25.
  • t=25t = 25 to 3838: P2P_2 (1313) runs to completion at t=38t = 38.
ProcessArrival Time (AT)Burst Time (BT)Completion Time (CT)Turnaround Time (TAT = CT - AT)
P1P_10101616
P2P_21133837
P3P_32686
P4P_4892517

Average turnaround time =16+37+6+174=764=19 ms= \frac{16 + 37 + 6 + 17}{4} = \frac{76}{4} = 19\text{ ms}.

Final answer

Option (D)

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2025 Computer Science and Information Technology - Session 2 (CS2)
Question
26 of 65
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.