CS FundamentalsHardTCS NQT · Infosys pattern
Processes (arrival, burst, priority — a smaller number means higher priority): P1 (arrival 0, burst 4, priority 1), P2 (arrival 2, burst 6, priority 4), P3 (arrival 4, burst 2, priority 3), P4 (arrival 7, burst 8, priority 2). 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?
- A. P4 completes at 16; average response time 1 ms
- B. P4 completes at 15; average response time 2 ms
- C. P4 completes at 13; average response time 0 ms
- D. P4 completes at 15; average response time 1 ms
Correct answer: D. P4 completes at 15; average response time 1 ms
Simulating with a preemption check on every priority change gives completion times P1 4, P3 6, P4 15, P2 20 and response times (first run − arrival) P1 0, P2 4, P3 0, P4 0, averaging 1 ms. Treating the scheme as non-preemptive would move P4's completion time.
More Operating Systems questions
- Processes (arrival, burst) in ms: P1 (arrival 0, burst 4), P2 (arrival 2, burst 6), P3 (arrival 4, burst 2), P4 (arrival 7, burst 8). They…
- Processes (arrival, burst) in ms: P1 (arrival 0, burst 4), P2 (arrival 2, burst 6), P3 (arrival 4, burst 2), P4 (arrival 7, burst 8)…
- Processes (arrival, burst) in ms: P1 (arrival 0, burst 10), P2 (arrival 1, burst 3), P3 (arrival 2, burst 7), P4 (arrival 4, burst 2), P5…
- Processes (arrival, burst) in ms: P1 (arrival 0, burst 10), P2 (arrival 1, burst 3), P3 (arrival 2, burst 7), P4 (arrival 4, burst 2), P5…
- Processes (arrival, burst, priority — a smaller number means higher priority): P1 (arrival 0, burst 10, priority 2), P2 (arrival 1, burst…
- Processes (arrival, burst) in ms: P1 (arrival 0, burst 10), P2 (arrival 1, burst 3), P3 (arrival 2, burst 7), P4 (arrival 4, burst 2), P5…