in Operating System
779 views
2 votes
2 votes
Consider a CPU running 10 i/o bound task and 1 CPU bound task. Assume that i/o bound task issue an i/o operation once for every millisecond of CPU computing and that each i/o operation takes 10 ms to complete. Also, assume that context switching overhead is 0.1 ms and that all processes are lng running tasks. What is the utilization (in %) for a round-robin scheduler when the time quantum is 10ms.
in Operating System
779 views

2 Answers

4 votes
4 votes
Best answer
There are 10 I/O bound task and 1 CPU bound task. It is given that time quantum is 10ms. As after every 1 ms each I/O bound task goes for performing I/O for the next 10ms, so 10*(1+0.1)=10*1.1=11ms time is spent by the 10 I/O bound task in CPU computation(including context switch time) and the 1 CPU bound task executes for a time quantum of 10ms, so total time spent by the cpu bound task= 10+0.1=10.1ms

hence out of total 11+10.1= 21.1ms, for (10*1)+10= 20ms CPU is utilized and the remaining time is spent in context switches.

Therefore, CPU utilization= (20/21.1)*100= 94.78%
selected by

18 Comments

CPU bound task executes for a time quantum of 10ms, so total time spent by the cpu bound task= 10+0.1=10.1ms

      Somoshree Datta 5 I AM NOT GETTING THAT FROM WHERE 0.1 COMES IN ABOVE MEANS ALL OVERHEAD IS DONE ABOVE WHICH OVERHEAD IS THIS?

0
0
It is clearly mentioned in the question that 0.1ms is the overhead involved in context switching. So when a process is preempted from CPU and another process is given a chance to execute, then the amount of time needed to switch context is 0.1ms.
1
1
OK OK  GOT YOUR POINT

ACTUALLY I WAS THINKING THAT THIS OVERHEAD IS INCLUDING  FOR NEXT CPU PROCESS WHICH IS EVER GOING TO COME
0
0
@somosheree Datta Thanks i got it...
0
0

 (10*1)+10= 20ms

@Somoshree can u derive this line? 

0
0
Each of the 10 I/O bound processes execute in the cpu for 1ms before performing 10ms of I/O. So 10*1 ms is spent by 10 I/O bound processes in the cpu. Moreover the cpu bound process takes 10ms of time in the cpu as time quantum is given as 10ms.So total 10*1+10= 20ms is the time during which cpu is utilised in the first 21.1ms.
0
0

. Moreover the cpu bound process takes 10ms of time in the cpu as time quantum is given as 10ms.

where u got this?

question says

  Assume that i/o bound task issue an i/o operation once for every millisecond of CPU computing and that each i/o operation takes 10 ms to complete.

0
0
In order to solve this question, we need to assume that since its cpu bound process, so it will execute for at least one time quantum (as cpu bound process means a process that requires large amount of cpu time). since nothing is mentioned in the question about the time that the cpu bound process takes, so we need to make this assumption. Or else how do we solve this question if we don't make this assumption?
0
0
@Shaik
can u chk this plz

by the way , someone removed best answer tag?
But It is not still proved wrong :p
0
0
edited by

@srestha, mam, in the question they mentioned that

that all processes are long running tasks.

it means  the CPU Bound process have more than the TQ, By taking first cycle completion, we are calculating the utilization of CPU.

But there is a problem with considering the context switches at front ( Before starting the schedule, we choose one process then we have to load it, some people call it as also context switch ) and at end (May it enter into next cycle due to loading the process which is already preempted. )

But we can say it is approximately, $\frac{20}{21.1}$ or $\frac{20}{21}$

0
0
1 CPU bound takes 10 as time quantum
then 10 IO bound how takes 10 as time quantum?
Is it not $10*10=100$??
Plz elaborate
0
0

@Somoshree

Each of the 10 I/O bound processes execute in the cpu for 1ms before performing 10ms of I/O.

10 ms for IO

0.1 ms for context switch

total (10+0.1=10.1) ms

Now, we have to calculate 10 such IO operation before CPU operation

right?

Am I doing mistake?

0
0

even though tq=10ms, but each i/o use only 1ms and then go for I/O, then as per round robbin, it choose another process from the ready queue.

1
1

even though tq=10ms, but each i/o use only 1ms and then go for I/O,

 but why?

Why not 2 or 3 or other? Why 1?

0
0

due to after 1ms, it( I/o Bound process ) issue an i/o operation, therefore it goes for i/o

Assume that i/o bound task issue an i/o operation once for every millisecond of CPU computing

from the question

1
1
ok , thanks :)
0
0

in that link, the 2nd question, which is not numbered is similarly

https://gateoverflow.in/118298/gate2017-1-18

Mam, from which university prepare this assignment ?

0
0
0 votes
0 votes
Though time quantum is 10ms, but I/O bound process will only occupy 1ms of cpu and then go to block state as it need I/O, and thus there is 0.1ms of context switching.

So total time taken by I/O bound process will be= 10*1

But CPU bounded process uses its whole 10ms of time slice and 0.1ms of switching. So it takes total time of 1*10=10ms

And total context switching time=11*0.1=1.1ms

Therefor total time taken=10+10+1.1=21.1ms

and time for which cpu was busy/doing execution=10*1+1*10=20

CPU utilisation=(20/21.1)*100=94%