CS FundamentalsHardGATE CS · Amazon/Microsoft SDE MCQ

Processes (arrival, burst): P1 (0, 8), P2 (1, 4), P3 (2, 9), P4 (3, 5), P5 (6, 2). Under SRTF (preemptive SJF; a running process keeps the CPU on a tie), what is the average waiting time?

  1. A. 6.4
  2. B. 7.8
  3. C. 11.0
  4. D. 12.0

Correct answer: A. 6.4

Gantt: P1 0-1, P2 1-5, P4 5-6, P5 6-8 (preempts P4, which has 4 left), P4 8-12, P1 12-19, P3 19-28. Waiting times 11, 0, 17, 4, 0 sum to 32: average 6.4. Non-preemptive SJF gives 7.8, FCFS 11.0, and 12.0 is the average turnaround.

More Operating Systems questions

Exams that ask this topic