Project ForgeSign up free
Operating Systems
Process Scheduling
GATE 2025
Hard

Processes P1, P2, P3, P4 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?

  • A22
  • B15
  • C37
  • 19

Explanation

Trace: P1 runs [0-1] (remaining 9) then P2 arrives (13, more, continue P1) [1-2] (remaining 8), then P3 arrives (6, shortest, preempt) — P3 runs [2-8] (completes, no shorter arrivals before P4 arrives exactly at t=8). At t=8: remaining are P1(8), P2(13), P4(9, just arrived) — P1 shortest, runs [8-16] (completes). Then P4(9) vs P2(13): P4 runs [16-25] (completes). Finally P2 runs [25-38] (completes). Turnaround = completion−arrival: P1=16, P2=37, P3=6, P4=17. Average = (16+37+6+17)/4 = 76/4 = 19.

Source: GATE CS 2025 (Session 2 / CS2) (2025)

This question is part of a 15-day revision cycle — sign in and Project Forge will bring it back the day before you'd forget it.

Start revising free