Redirected
edited by
8,629 views
3 votes
3 votes

Consider a system running ten I/O-bound tasks and one CPU-bound task. Assume that the I/O-bound tasks issue an I/O operation once for every millisecond of CPU computing and that each I/O operation takes 10 milliseconds to complete. Also assume that the context-switching overhead is 0.1 millisecond and that all processes are long-running tasks. Describe the CPU utilization for a round-robin scheduler when:

  1. The time quantum is 1 millisecond
  2. The time quantum is 10 milliseconds
edited by

3 Answers

Best answer
5 votes
5 votes

(a) Time quantum is 1 ms.

Whether a CPU bound or I/O bound process, it switches every one millisecond and when doing so, it incurs a 0.1 ms overhead. Thus, for every 1.1 ms, the CPU is actually utilized only 1 ms. So CPU utilization is $\frac{1}{1.1}*100=91$%

(b) Time quantum is 10 ms.

Here, there is a difference between CPU bound and I/O bound processes. A CPU bound process can use the full 10 ms time slot, whereas an I/O bound process can have it only for 1 ms because another I/O bound process in the queue will snatch the time from it. So a CPU bound process takes 10 ms, 10 I/O bound processes would take 10*1=10ms. So, the CPU would be utilized for a total of 20 ms out of 21.1 ms. (Total time is 10*1.1 + 10.1=21.1ms). Thus the CPU utilization is $\frac{20}{21.1}*100=95$%

selected by
2 votes
2 votes
i/o1 i/o2 i/o3 i/o4 i/o5 i/o6 i/o7 i/o8 i/o9 i/o10 cpu1 .....

according to question given at every 1ms i/o operation done . and it will be completed in 10 ms . so 10 i/o operation have 

time = 10*1+.1*10 = 11ms ...(here 0.1 switching overhead )

cpu task ,for which we can consider it runs for 10ms bcoz i/o operation will be completed in 10ms ... (given as all process are long running tasks) 

so if case 1 ... time quantum is 1ms then cpu task takes = 10*1+10*0.1(switching after every 1ms quantum time)= 11ms 

so cpu utilization = useful work/ total work

                                (10*1+10*1)/11+11= 20/22=90.90%

case 2 time quantum =10ms so cpu takes = 10*1+1*.1=10.1

cpu utilization = 20/ 11+10.1= 20/ 21.1 = 94.78%

1 votes
1 votes
all task are long running task so we cannot wait to complete as no limit is given so i take one cycle in consideration.

the efficency will be same in one cycle or 100 cycles.

one cycle will be from the execution of P0 till it comes back again.

now starting with p0 context switch is taken by this symbol ]

p0 ] p1 ] p2 ]..........p10 ] total ( 11 process)

thsi will be one cycle .. not to forget the last context switch as we have not considered a context switch on before p0. so we have to consider the last one .

now p1 will execute for 1 unit and then will go for i/o and will come back after 10 ms which is 11 ms.

well as no cpu time will be wasted as it will always have a job to execute and i/o will be overlapped like the normal day practice it will work like normal and only wastage will be context switch time which will be 11 *0.1=1.1 ms

efficiency = (11-1.1)/11*100= 90%. well the process which is cpu bound will not have to go to i/o so he will just exit the queue and again come in line.  it will not have any effect here .

 

2 case.

now time quantum is 10 ms

so we know after every 1ms process goes to i/o. but a process will only be preempted when time quantum expires .

so now the cycle time will be 110 as every process is running for 10 ms. and all are long tasks not completing in one or 2 cycles

so the context switch will be the same and the wastage will also be same 1.1.

but in the time quantum every process will only do 1 ms of usefull time and all 9 ms will be wasted . except the process which is cpu bound . he will work the whole time. so usefull time will be 1*10+10

20 unit will be only the usefull work .minus the context switch overhead = 20-1.1

18.9 is the actual useful work out of 110. so efficiency = 18.9/110*100= 17.18 %

Related questions

1 votes
1 votes
1 answer
1
Pankaj kumar asked Jul 30, 2016
1,343 views
A CPU-scheduling algorithm determines an order for the execution of its scheduled processes. Given n processes to be scheduled on one processor, how many different schedu...
0 votes
0 votes
0 answers
2
0 votes
0 votes
0 answers
3
akash.dinkar12 asked Mar 20, 2019
210 views
Under what circumstances is $rate$-$monotonic$ $scheduling$ inferior to $earliest$-$deadline$-$first$ $scheduling$ in meeting the deadlines associated with processes ?
0 votes
0 votes
0 answers
4
akash.dinkar12 asked Mar 20, 2019
316 views
Discuss ways in which the priority inversion problem could be addressed in a real-time system. Also discuss whether the solutions could be implemented within the context ...