GATE Computer Science · Operating Systems and Computer Networks · medium

Three processes P1, P2, and P3 arrive at times 0 ms, 1 ms, and 2 ms with CPU burst times of 8 ms, 4 ms, and 2 ms respectively. Under preemptive Shortest Remaining Time First (SRTF) scheduling, what is the average turnaround time across the three processes?

Published · Last updated · checked before publication — how we verify questions

Options

  • A10.33 ms (31 / 3 ms) computed by running P1 to completion before P2 and P3
  • B4.67 ms (14 / 3 ms) representing average waiting time rather than turnaround time
  • C7.33 ms (22 / 3 ms) with completion times P3 = 4 ms, P2 = 7 ms, P1 = 14 msCorrect answer
  • D8.00 ms (24 / 3 ms) computed by summing completion times directly

Answer: C. 7.33 ms (22 / 3 ms) with completion times P3 = 4 ms, P2 = 7 ms, P1 = 14 ms

At t=0, P1 runs (remaining 7 at t=1). At t=1, P2 arrives (burst 4 < 7), preempting P1; P2 runs 1..2 (remaining 3). At t=2, P3 arrives (burst 2 < 3), preempting P2; P3 runs 2..4 and completes at t=4 (TAT_3 = 4 - 2 = 2 ms). Then P2 runs 4..7 and completes at t=7 (TAT_2 = 7 - 1 = 6 ms). Finally P1 runs 7..14 and completes at t=14 (TAT_1 = 14 - 0 = 14 ms). Average TAT = (14 + 6 + 2) / 3 = 22 / 3 = 7.33 ms.

Why the other options are wrong

  • A. 10.33 ms (31 / 3 ms) computed by running P1 to completion before P2 and P3 — Running P1 non-preemptively to t=8 is FCFS/non-preemptive SJF, not preemptive SRTF.
  • B. 4.67 ms (14 / 3 ms) representing average waiting time rather than turnaround time — Waiting times are (6 + 2 + 0)/3 = 2.67 ms; turnaround time is Completion Time minus Arrival Time.
  • D. 8.00 ms (24 / 3 ms) computed by summing completion times directly — Turnaround time is CT - AT ((14 - 0) + (7 - 1) + (4 - 2) = 22), whereas 14 + 7 + 4 = 25.

All Operating Systems and Computer Networks questions and the topic overview →

GATE is a mark of the Indian Institute of Science and the Indian Institutes of Technology. PrepIQ Hub is not affiliated with, endorsed by, or sponsored by the GATE Committee.