Skip to main content

GATE CSE 2025Operating System › CPU SchedulingVerified

GATE CSE 2025 PYQ: ​​​Processes P 1 , P 2 , P 3 , P 4 P 1, P 2, P 3, P 4 P 1 , P 2 , P 3 , P 4 arrive in that order at times 0…

​​​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?

  1. A
    22
  2. B
    15
  3. C
    37
  4. D
    19
    Correct answer

Answer

(D) 19 19 19

Approach

Simulate shortest-remaining-time-first scheduling by tracking the remaining CPU burst of every arrived process. Whenever a new process arrives, compare its remaining time with the currently running process; preempt if the new process is shorter. Then compute completion time and turnaround time for each process.

Using SRTF, the Gantt chart is P1 [0-2], P3 [2-8], P1 [8-16], P4 [16-25], P2 [25-38]. The turnaround times are 16, 37, 6, and 17 ms, so the average is 76/4 = 19 ms. Hence option D is correct.

Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.