The Gateway to Computer Science Excellence
+26 votes

Three processes $A$, $B$ and $C$ each execute a loop of $100$ iterations. In each iteration of the loop, a process performs a single computation that requires $t_c$ CPU milliseconds and then initiates a single I/O operation that lasts for $t_{io}$ milliseconds. It is assumed that the computer where the processes execute has sufficient number of I/O devices and the OS of the computer assigns different I/O devices to each process. Also, the scheduling overhead of the OS is negligible. The processes have the following characteristics: 

$$\begin{array}{|c|c|c|} \hline \textbf{Process id} & \textbf{$t_c$} & \textbf{$t_{io}$} \\\hline \textbf{A} & \text{100 ms} & \text{500 ms} \\\hline \textbf{B} & \text{350 ms} & \text{500 ms}\\\hline \textbf{C} & \text{200 ms} & \text{500 ms} \\\hline   \end{array}$$

The processes $A$, $B$, and $C$ are started at times $0$, $5$ and $10$ milliseconds respectively, in a pure time sharing system (round robin scheduling) that uses a time slice of $50$ milliseconds. The time in milliseconds at which process C would complete its first I/O operation is ___________. 

in Operating System by Veteran (105k points)
edited by | 3k views

 each execute a loop of 100 iterations. 


Means each ABC do 100 iterations.Each iteration it does tc and tio

3 Answers

+38 votes
Best answer
Gantt chart : $ABCABCBCBC$
$C$ completes it CPU burst at$= 500$ milli second.
IO time $= 500$ milli second
$C$ completes $1$st IO burst at $t = 500 + 500 = 1000$ms
by Veteran (60.5k points)
edited by
here are three processes A, B and C that run in 
round robin manner with time slice of 50 ms.

Processes atart at 0, 5 and 10 miliseconds.

The processes are executed in below order
A, B, C, A 
50 + 50 + 50 + 50 (200 ms passed)

Now A has completed 100 ms of computations and 
goes for I/O now

B, C, B, C, B, C
50 + 50 + 50 + 50 + 50 + 50 (300 ms passed)

C goes for i/o at 500ms and it needs 500ms to
finish the IO.

So C would complete its first IO at 1000 ms

where are you accounting for 100 iterations?
Question has asked for completion of first I/O so need not consider anything beyond it

It is given that a process initiates IO , so it could be the case that after initiating the IO it again starts with the next iterations, then instead of ABCABCBCBC , we would have ABCABCABCABC. So what is stopping A's next iteration from starting.

After 100 ms of computation, process A has to perform I/O for 500 ms for completing the 1st iteration. Only after completing 1st iteration can process A start 2nd iteration.
Maybe, but then it is mentioned that there are sufficient IO devices, I think it refers to the buffering ability of the devices, so that requests can be buffered.
What if input of 1st iteration of A is used in computation of 2nd iteration of A? Then buffering won't help since you've got to take input before processing it.

There are sufficient I/O devices implies that we can overlap I/O of the processes I.e I/O of processes a,b and c can be done simultaneously. If sufficient I/O devices weren't available, then maybe for example process C has to wait for process B's I/O to complete. A similar question:

After 1st CPU burst of C why it doesnt go for IO operation ie after 150ms.?
Why didn't the second iteration of A start? I believe the second iteration of A (A2) needn't wait for IO of previous A (A1)


 In each iteration of the loop, a process performs a single computation that requires tc CPU milliseconds and then initiates a single I/O operation that lasts for tio milliseconds.

A is one process.Multiple process I/o can overlap but not one process.You can think A as:-

For i=1 to 100


Do CPU time;

DO I/o time


@rahul sharma 5

So CPU can't start A (A2) again till previous A (A1) has finished?
+2 votes

please check someone

by Junior (765 points)
–2 votes
Answer is B
by Loyal (9.6k points)

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
50,648 questions
56,429 answers
99,922 users