3.3k views

A uni-processor computer system only has two processes, both of which alternate $10$ $\text{ms}$ CPU bursts with $90$ $\text{ms}$ I/O bursts. Both the processes were created at nearly the same time. The I/O of both processes can proceed in parallel. Which of the following scheduling strategies will result in the least CPU utilization (over a long period of time) for this system?

1. First come first served scheduling

2. Shortest remaining time first scheduling

3. Static priority scheduling with different priorities for the two processes

4. Round robin scheduling with a time quantum of $5$ $\text{ms}$

edited | 3.3k views
0
@arjun sir , need an answer to this question
0
hey by mistake i hide sol :) You chek the sol.
0

@Bikram sir pls see this bold text part  Am I thinking right ?

both of which alternate 10 ms CPU bursts with 90 ms I/O bursts.

it means  cpu burst followed with i/o burst

p1=(0-10)cpu burst  since  both the processes were created at nearly the same time p2 inintial waiting will be 10

p2=(10-20)cpu burst

p1=(20-80)(process p1 i/o burst)

p2=(80-100)p2 remaining i/o burst

cpu utilization = cpu burst/total time

(20/100)*100=20%

+3

Need some slide changes in P1 and P2  I/O burst in your calculation .. rest cpu burst you calculated correctly.

Given 10 ms CPU bursts with 90 ms I/O bursts ..

P1 goes for I/O burst from 10-100.

P2 I/O starts at 20 and goes from 20 to 110 .

cpu utilization = cpu burst time/ total time

here total time is 100  ( 10 + 90)

within 100 , cpu is used 10 for p1 and 10 for process p2 so in total 10+10 = 20

so cpu utilization = (20/100) * 100 = 20%

0
@bikram sir

that was very silly mistake in my method that without getting CPU to p2 I was calculating 0-10 i/o time for cpu

this is not possible,without getting cpu how can process going into block state

thnks a lot for correcting me
+1

Notice --> importance of word "over a long period of time"

Little bit similar question - https://gateoverflow.in/1843/gate2006-65

CPU utilization $=$ CPU burst time/Total time.

FCFS:
from $0-10:$ process $1$
from $10-20:$ process $2$
from $100-110:$ process $1$
from $110-120:$ process $2$
....
So, in every $100$ ms, CPU is utilized for $20$ ms, CPU utilization $= 20\%$

SRTF:
same as FCFS as CPU burst time is same for all processes

Static priority scheduling:
Suppose process $1$ is having higher priority. Now, the scheduling will be same as FCFS. If process $2$ is having higher priority, then the scheduling will be as FCFS with process $1$ and process $2$ interchanged. So, CPU utilization remains at $20\%$

Round Robin:
Time quantum given as $5$ ms.
from $0-5:$ process $1$
from $5-10:$ process $2$
from $10-15:$ process $1$
from $15-20:$ process $2$
from $105-110$: process $1$
from $110-115:$ process $2$
...

So, in $105$ ms, $20$ ms of CPU burst is there. So, utilization $= 20/105 = 19.05\%$

$19.05$ is less than $20$, so answer is (D).

(Round robin with time quantum 10ms would have made the CPU utilization same for all the schedules)

edited by
0

@arjun sir ,  Im just concluding what i understood . Correct me if Im wrong .

If there are n process and each process does

• 10 ms CPUburst
• 90ms IO burst
• 10ms CPU burst

Then for finding CPU utilization should I have to consider only ( 1CPU burst +  1 IO burst ) ?

CPU Utilisation is the time CPU does a useful work IN ONE CYCLE TIME
Cycle time is ( 1 CPU time + 1 IO time )

+1

Now you are making it more complex :)

least CPU utilization (over a long period of time)

So, in the long period of time, you can take any repeating pettern.

• 10 ms CPUburst
• 90ms IO burst
• 10ms CPU burst

Is not a repeating pattern because 10ms CPU burst is followed by 90ms IO burst. So, it must be either

• 10 ms CPUburst
• 90ms IO burst

Or

• 10 ms CPUburst
• 90ms IO burst
• 10ms CPU burst
• 90ms IO burst

CPU Utilisation is the FRACTION of time CPU does a useful work as is any Utilization. Numerator and Denominator can be any length of time.

+1
@arjun sir , Thank you so much :)
Actually the question had clearly defined cycle time as 10ms + 90 ms
But I misinterpreted "both of which alternate 10 ms CPU bursts with 90 ms I/O bursts" as cycle time is 10ms +90 ms +10ms .
+1
that's the power of gateoverflow every question has been explained so nicely by the expert that it seems so easy :)
–1
i did understand that RR explanation what i did  not understand is in FCFS one cycle is completed in the 110 s   a follows     po  p1  p0  p1

0   10   20   100 110

so cpu utilization should be 20/110 which is 18% approx so FCFS should be answer by this way
0

Time needed for process is 100 Na so why u take 110 as completion time.

When p2 executed first time then 10 unit of input output for p1 already completed. So, remaining is 80 which is overlapped with p2 input output.

+1
@eddy

given , burst time is 10 ms and I/O time is 90 ms .

In FCFS
it starts from 0 goes to 10 for p1 cpu burst.
then P1 goes for I/O burst from 10-100.

At same time when p1 complete burst at 10 , p2 burst start and goes to 10-20. after that p2 I/O starts and goes from 20 to 110 .

cpu utilization = cpu burst time/ total time

here total time is 100

within 100 , cpu is used 10 for p1 and 10 for process p2 so in total 10+10 = 20

so cpu utilization = (20/100) * 100 = 20%
0
What if srtf is preemtive then i think this will give worst because in 19 p1 will finish its Burst time then 90 I/O so 19+90=119 so CPU utilization would become 20/119 so 16.80%

please correct me if i am wrong
0

Hi @Arjun Sir , Everyone

I have drawn Gantt chart in excel . I am getting answer as 20% even for D.

Can you please correct my Gantt chart. I am attaching excel sheet so that you don't have to redraw everything

https://gateoverflow.in/?qa=blob&qa_blobid=1927053546862752235

Sheet 2 in excel workbook contains meaning of symbol

0
@mehul, in question it is mentioned that I/O for both process can be executed in parallel but you are executing in RR manner which is wrong according to your gantt chart you will get cpu utilization as 20/195 = 10.2 %.