The GATE Grind

GATE 2014 CS (CS3) – Question 42

Operating System · CPU and I/O Scheduling · 2 marks · Numerical answer

A preemptive OS uses shortest remaining time first. Process (arrival time, CPU burst), in ms: P1(0,12), P2(2,4), P3(3,6), P4(8,5). Find average waiting time (ms).

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: 5.5 to 5.5

Explanation

The execution order is P1:0–2,P2:2–6,P3:6–12,P4:12–17,P1:17–27. Completion minus arrival minus burst gives waits15,0,3,4ms. Their mean is22/4=**5.5ms**. At time8,P3has only4msremaining, shorter than arrivingP4’s5ms.