Similar questions 7 more →
CPU Scheduling

Answer & solution
Official answer: 3.0
Our answer: 3
Step through it (7 steps)
1. Run P1 at t=0. At t=3 it has 4 ms left, so newly arrived P2 with 3 ms preempts it. At t=5 P2 has only 1 ms left, less than P3’s 5, so P2 continues to completion at 6.
2. At t=6 choose P4’s 2 ms over P1’s 4 and P3’s 5. P4 completes at 8, P1 runs 8–12, then P3 runs 12–17.
3. Waiting=completion−arrival−burst. For P1,P2,P3,P4 these are 12−0−7=5,6−3−3=0,17−5−5=7,8−6−2=0. Average=(5+0+7+0)/4=3 ms.