CS FundamentalsVery hardHCLTech · Infosys placement pattern

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

  1. A. P5 completes at 19; average response time 10.2 ms
  2. B. P5 completes at 17; average response time 8.2 ms
  3. C. P5 completes at 19; average response time 9.2 ms
  4. D. P5 completes at 20; average response time 9.2 ms

Correct answer: C. P5 completes at 19; average response time 9.2 ms

Simulating with a preemption check on every priority change gives completion times P2 4, P1 13, P5 19, P3 26, P4 28 and response times (first run − arrival) P1 0, P2 0, P3 17, P4 22, P5 7, averaging 9.2 ms. Treating the scheme as non-preemptive would move P5's completion time.

More Operating Systems questions

Exams that ask this topic