- 2079 Jestha · 4 marks
CPU free percentage with I/O (round robin)
Short answer
With round-robin quantum 5 ms, CPU is idle during 0–2 ms and 29–33 ms, giving 6 ms free out of 33 ms total; CPU free = 18.18 %.
Three processes P1, P2 and P3 arrive at time zero. Their total execution time is 10 ms, 15 ms, and 20 ms respectively. They spent first 20% of their execution time in doing I/O, next 60% in CPU processing and the last 20% again doing I/O. For what percentage of time was the CPU free? Use Round robin algorithm with time quantum 5 ms.
The CPU is free whenever no process is ready to use it. Each process does I/O first, then CPU work, then I/O again; I/O of different processes is assumed to run in parallel (each has its own device), and only CPU bursts are scheduled by round robin with quantum 5 ms.
Phase times
| Process | Total | First I/O (20%) | CPU (60%) | Last I/O (20%) |
|---|---|---|---|---|
| P1 | 10 | 2 | 6 | 2 |
| P2 | 15 | 3 | 9 | 3 |
| P3 | 20 | 4 | 12 | 4 |
All three processes arrive at 0 and start with I/O, so they enter the CPU ready queue at 2, 3 and 4 ms respectively.
Schedule
|idle| P1 | P2 | P3 | P1 | P2 | P3 |P3|idle|
0 2 7 12 17 18 22 27 29 33
- 0-2: CPU free (everyone is doing first I/O).
- 2-7: P1 runs 5 ms (1 ms of its 6 ms left). P2 and P3 join the queue at 3 and 4.
- 7-12: P2 runs 5 ms (4 left). 12-17: P3 runs 5 ms (7 left).
- 17-18: P1 finishes its CPU work; it then does last I/O 18-20.
- 18-22: P2 finishes its CPU work (4 ms); last I/O 22-25.
- 22-27: P3 runs 5 ms (2 left); 27-29: P3 runs the last 2 ms (alone, no other process is ready).
- 29-33: P3 does its last I/O; the CPU is free.
Everything ends at 33 ms (P1 at 20, P2 at 25, P3 at 33).
Calculation
Total CPU busy time = 6 + 9 + 12 = 27 ms
Total time = 33 ms
CPU free time = 33 - 27 = 6 ms (0-2 and 29-33)
CPU free percentage = 6 / 33 x 100 = 18.18 %
Answer: the CPU is free for about 18.18 % of the time (CPU utilisation 81.82 %).
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Round robin scheduling (9, 6, 3 ms, q=2) · Embedded System, chapter 6 · asked 4×
- Round robin scheduling (6, 4, 2 ms, q=2) · Embedded System, chapter 6 · asked 4×
- Round robin scheduling (53, 17, 68, 24 ms) · Embedded System, chapter 6 · asked 4×
- Round robin scheduling (5, 8, 7 ms, q=2) · Embedded System, chapter 6
- Round robin scheduling (9, 6, 3 ms, q=3) · Embedded System, chapter 6 · asked 4×
- Non-preemptive priority scheduling (10, 5, 7 ms) · Embedded System, chapter 6 · asked 2×
- Liang-Barsky: P1(-5,3), P2(15,9) · Computer Graphics, chapter 3
- Round Robin MST on 7-vertex graph · Data Structure and Algorithm, chapter 10
- Spanning tree properties; Round Robin MST · Data Structure and Algorithm, chapter 10
- First order filter: pole -100, zero -1000, gain 10 · Filter Design, chapter 6