• edited by
53,710 views
92 92 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 $20\%$ of execution time doing I/O, the next $70\%$ of time doing computation, and the last $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. $0\%$
  2. $10.6\%$
  3. $30.0\%$
  4. $89.4\%$

11 Answers

Best answer
127 127 votes

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

Answer is option (B).

• edited by
34 34 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%

11 11 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 %
2 2 votes
  $i/o$ $cpu$ $i/o$
1 2 7 1
2 4 14 2
3 6 21 3

 

Assume that all I/O operations can be overlapped as much as possible.

 

$\underbrace{0-2}$ $\underbrace{2-9}$ $\underbrace{9-23}$ $\underbrace{23-44}$ $\underbrace{44-47}$
$idle$ $p1$ $p2$ $p3$ $idle$

$\dfrac{5}{47}\times 100=10.6\%$

Answer:
Position:
Show:

Related questions

73 73 votes
9 answers 9 answers
41.0k
41.0k views
Rucha Shelke asked Sep 26, 2014
40,970 views
Consider three processes (process id $0$, $1$, $2$ respectively) with compute time bursts $2$, $4$ and $8$ time units. All processes arrive at time zero. Consider the lon...
61 61 votes
6 answers 6 answers
24.7k
24.7k views
Rucha Shelke asked Sep 16, 2014
24,734 views
Consider three CPU-intensive processes, which require $10$, $20$ and $30$ time units and arrive at times $0$, $2$ and $6$, respectively. How many context switches are nee...
55 55 votes
7 answers 7 answers
14.8k
14.8k views
go_editor asked Apr 24, 2016
14,780 views
Barrier is a synchronization construct where a set of processes synchronizes globally i.e., each process in the set arrives at the barrier and waits for all others to arr...
105 105 votes
6 answers 6 answers
28.3k
28.3k views
Rucha Shelke asked Sep 26, 2014
28,338 views
Barrier is a synchronization construct where a set of processes synchronizes globally i.e., each process in the set arrives at the barrier and waits for all others to arr...