The GATE Grind

GATE 2011 CS (CS1) – Question 45

Operating System · CPU and I/O Scheduling · 2 marks · Multiple choice

Processes P₀,P₁,P₂ have arrivals 0,1,2 ms and bursts 9,4,9 ms respectively. Use preemptive shortest-job-first, scheduling only at arrivals/completions. Find average waiting time.

  1. 5.0 ms
  2. 4.33 ms
  3. 6.33 ms
  4. 7.33 ms

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (A) 5.0 ms

Explanation

P₀ runs 0–1 then P₁ preempts and completes at five. P₀ has eight remaining, less than P₂’s nine, so P₀ runs 5–13, then P₂ runs 13–22. Waiting times are 13−0−9=4, 5−1−4=0 and 22−2−9=11. Average is (4+0+11)/3=5 ms, A.

More CPU and I/O Scheduling questions

All CPU and I/O Scheduling questions →