The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+20 votes
3.7k views

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%}$
asked in Operating System by Active (3.7k points)
edited by | 3.7k views

6 Answers

+40 votes
Best answer

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

Answer is option (B).

answered by Boss (30.8k points)
edited by
+1
Can you explain a bit? Didn't understood the diagram?
+1

in the first time interval of $\{0-2\}$ there are 3 processes working simultaneously at I/O and at the same time CPU is idle. but in the third time interval i.e. $\{4-6\}$ process 1 is running on the CPU, Process 3 is busy doing its I/O and the process 2 is waiting in the ready queue coz it needs CPU but its occupied.

+1
there are only 3 processes in the system, and no new processes are to come, so cpu idle time is 2+3
+3

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

+1
p2 has compute time 14 and p3 has compute time 11 ..and we are following shortest compute time so how can you schedule p2 first and then p3
+1
I've rechecked; It is correct.
+3
Do we have to consider the last I/O time as it can be allotted to any process thereafter so the only idle time for CPU must be the starting 2 unit time. (As the CPU is idle after 44 unit time)
+3
Yes we have to consider the last I/O as the CPU does not terminate on its own. A system request is sent after the completion of the last process to terminate the execution.
+1
So, i/o and cpu can be scheduled at a same time?
+1
Throughput here is 3/47 right ..?
0
nice explanation @ amarvashistha
0
what if new process p4 arrives at 44 having burst time 3 units other than p1 p2 p3.

Then out of total 47 cpu will be idle for 2 units only ??

As we don't know is there any such process comng  in ready queue other than p1 p2 p3 at 44 we have to consider till 44 only

Hence % idle  =( 2/44) * 100
0
for i/o there is i/o processor
0

@jatin khachane 1

we have to calculate with that instance only.

if you didn't agree that, then i can say at t=1, there is P4 come with BT=1, then your answer also wrong.

isn't it?

0
Why should we consider 44-47 as CPU idle time.

It can be answered based on this ques --> What operation is going on between 44-47?? I / O

Does that employs CPU idle ??
0
yes, I/O means CPU idle...
0

Ok means we are considering only processes possible which are given in question..

+2
yes, otherwise 0-2 also not lead to idle time of CPU
+9 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%

answered by Active (4.4k points)
+7 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 %
answered by (277 points)
+5 votes

Option "B" 

answered by Loyal (8.2k points)
+2 votes

Answer will be 10.6382

answered by Active (3.9k points)
0 votes
ans (B)..
answered by Active (5k points)
0
Explain ...
Answer:

Related questions



Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

42,599 questions
48,600 answers
155,672 comments
63,739 users