CS FundamentalsHardProduct company interview · GATE level

Processes (arrival, burst, priority — a smaller number means higher priority): P1 (arrival 0, burst 2, priority 4), P2 (arrival 1, burst 9, priority 2), P3 (arrival 3, burst 4, priority 3), P4 (arrival 5, burst 5, priority 1). Preemptive priority scheduling is used. At what time does P4 complete, and what is the average response time (first time on the CPU minus arrival) over all processes?

  1. A. P4 completes at 11; average response time 3 ms
  2. B. P4 completes at 10; average response time 4 ms
  3. C. P4 completes at 8; average response time 2 ms
  4. D. P4 completes at 10; average response time 3 ms

Correct answer: D. P4 completes at 10; average response time 3 ms

Simulating with a preemption check on every priority change gives completion times P4 10, P2 15, P3 19, P1 20 and response times (first run − arrival) P1 0, P2 0, P3 12, P4 0, averaging 3 ms. Treating the scheme as non-preemptive would move P4's completion time.

More Operating Systems questions

Exams that ask this topic