CS FundamentalsVery hardGATE CS

Two processes each alternate CPU and I/O: P1 = CPU 4, I/O 6, CPU 2; P2 = CPU 3, I/O 3, CPU 5 (ms). Both arrive at 0, P1 first; scheduling is FCFS on one CPU and each process has its own I/O device (I/O runs in parallel). When does the last process finish, and what is the CPU idle time in that interval?

  1. A. 14 ms and 0 ms
  2. B. 23 ms and 9 ms
  3. C. 17 ms and 0 ms
  4. D. 17 ms and 3 ms

Correct answer: D. 17 ms and 3 ms

CPU: P1 0–4, P2 4–7. P2's I/O runs 7–10, P1's I/O 4–10. At 10 both are ready; P1 (queued first, its I/O ended at the same time) runs 10–12, P2 12–17. CPU idle 7–10 = 3 ms; all done at 17.

More Operating Systems questions

Exams that ask this topic