Skip to content
Mad4Study

Engineering & Science

GATE Computer Science

  • GATE CS
  • 2026–27 pattern practice
  • Operating Systems
  • Scheduling
  • Medium

Processes P1, P2, P3 and P4 arrive at times 0, 1, 2 and 3 ms with CPU bursts of 8, 4, 9 and 5 ms. What is the average waiting time under preemptive Shortest Remaining Time First (SRTF)?

Process Management

Pick an option to check your answer.

Build the Gantt chart, always running the job with the least remaining time.

  1. P1 runs 0–1; P2 (4) beats P1's remaining 7 and runs 1–5.
  2. Then P4 runs 5–10, P1 runs 10–17 and P3 runs 17–26.
  3. Waiting time = completion − arrival − burst: P1 =17−0−8=9= 17 - 0 - 8 = 9, P2 =5−1−4=0= 5 - 1 - 4 = 0, P3 =26−2−9=15= 26 - 2 - 9 = 15, P4 =10−3−5=2= 10 - 3 - 5 = 2.
  4. Average =264=6.5= \tfrac{26}{4} = 6.5 ms.

Why not the others

  • 7.757.75 ms is the average under non-preemptive SJF for the same processes.
  • 8.758.75 ms corresponds to running the processes in arrival order (FCFS).
  • 5.55.5 ms leaves out part of P3's wait.

Report an error

GATE CS · Operating Systems · Process Management