edited by
30,631 views
60 votes
60 votes

Consider three processes, all arriving at time zero, with total execution time of $10$, $20$ and $30$ units, respectively. Each process spends the first $\text{20%}$ of execution time doing I/O, the next $\text{70%}$ of time doing computation, and the last $\text{10%}$ of time doing I/O again. The operating system uses a shortest remaining compute time first scheduling algorithm and schedules a new process either when the running process gets blocked on I/O or when the running process finishes its compute burst. Assume that all I/O operations can be overlapped as much as possible. For what percentage of time does the CPU remain idle?

  1. $\text{0%}$
  2. $\text{10.6%}$
  3. $\text{30.0%}$
  4. $\text{89.4%}$
edited by

7 Answers

Best answer
89 votes
89 votes

$$\text{CPU Idle time}=\frac{2+3}{47} \times 100 = 10.6383\%$$

Answer is option (B).

edited by
24 votes
24 votes
Process

TOTAL BURST 

TIME

I/O

TIME

CPU TIME I/O TIME
P1 10 (10*20/100)=2 (10*70/100)=7 (10*10/100)=1
P2 20 (20*20/100)=4 (20*70/100)=14 (20*10/100)=2
P3 30 (30*20/100)=6 (30*70/100)=21 (30*10/100)=3

GANTT CHART

Idle P1 P2 P3 Idle

0                          2                     9                     23                  44                    47

total time=47

idle time= 2+3=5

% of idle time= (5/47)*100=10.6%

9 votes
9 votes

Let three processes be p0, p1 and p2. Their execution time is 10, 20 and 30 respectively. p0 spends first 2 time units in I/O, 7 units of CPU time and finally 1 unit in I/O. p1 spends first 4 units in I/O, 14 units of CPU time and finally 2 units in I/O. p2 spends first 6 units in I/O, 21 units of CPU time and finally 3 units in I/O.

 idle   p0    p1     p2    idle
0    2     9     23     44     47

Total time spent = 47
Idle time = 2 + 3 = 5
Percentage of idle time = (5/47)*100 = 10.6 %
Answer:

Related questions