11,064 views
11 votes
11 votes

Suppose two jobs, each of which needs $10$ minutes of CPU time, start simultaneously. Assume $50\%$ I/O wait time. How long will it take for both to complete, if they run sequentially?

  1. 10
  2. 20
  3. 30
  4. 40

10 Answers

Best answer
22 votes
22 votes

"50% I/O wait time." mean 50% of the time CPU is waiting for IO.

ie: if total CPU time is 2x, then x times its doing IO operation and other x time it is running the process.

Now, calculate how much time CPU is running the process, it is 10+10 mins.(take processes in any order).

ie, x=20 mins, so 2x=40mins.

selected by
21 votes
21 votes
CPU TIME = 10 min, IO Time = 50% i.e. 50% for CPU & 50% for IO. (it is not 50% of CPU time, read question again)
IO time = CPU Time = 10ms

t=0 to 10ms,
A completes its CPU Burst.

t= 10 to 20,
B completes CPU & at same time A Complete its IO burst.

t=20 to 30,
B completes its IO.

Total time is 30ms.
edited by
6 votes
6 votes
 

50% I/O wait time means that a process is not in execution(i.e. CPU is sitting idle) for 50% of the total time a process requires from CPU to complete itself(its execution). Thus CPU Utilization turns out to be //whereas 50% I/O time means it needs 50% of total execution time(10 minutes) to complete its I/O.

50%=50/100 = .5

thus the time needed to complete a process which requires 10 minute of CPU will be = CPU time required by process/CPU utilization=

10/CPU utilization= 10/0.5 = 20 minutes.

when two processes run sequentially(one after the other) then the total time required will be = 10/0.5 + 10/0.5 = 20+20=40 minutes (ANSWER)

in case of parallel execution we again find the CPU utilization.. since two processes are in parallel thus the formulae becomes-->

{1-(I/O time)^no. of processes in parallel execution} =1-(0.5)^2=1-.25=0.75 now the CPU utilization for 1 process will be 0.75/2=0.375 Therefore the time required will be = CPU time required by process/CPU utilization= 10/0.375=26.67 minutes.

Since the two processes are running in parallel thus the time required by 1 process will be the total time required by 2 process=26.67 minutes

4 votes
4 votes

Answer : 40

From Entering a process in Ready Queue till its Completion we have 2 Times one is Burst Time  and second is Waiting Time.

it can wait in ready queue as long as it is not considered for execution and then CPU  Time (Burst Time) .Normally we don't include I/O time but here we have to consider it .

it is given that Cpu time is 10 min for each job so total CPU time would be 10+10 =20 if we consider this is the half time in which they are doing execution then other half if add to it then it would be 20 +20 =40 

As it is given in question 50% of the time they are doing I/O. This 50% which is left as 20 they will do CPU execution simultaneously .

Answer:

Related questions

13 votes
13 votes
2 answers
1
go_editor asked Jun 19, 2016
10,018 views
Suppose a system contains $n$ processes and system uses the round-robin algorithm for CPU scheduling then which data structure is best suited ready queue of the processst...
7 votes
7 votes
2 answers
2
go_editor asked Jun 19, 2016
3,818 views
Consider the following program.main() { fork(); fork(); fork(); }How many new processes will be created?8675
12 votes
12 votes
4 answers
3
go_editor asked Jun 17, 2016
3,820 views
In a lottery scheduler with 40 tickets, how we will distribute the tickets among 4 processes $P_1, P_2, P_3$ and $P_4$ such that each process gets 10%, 5%, 60% and 25% re...
6 votes
6 votes
2 answers
4
go_editor asked Jun 17, 2016
10,796 views
If there are 32 segments, each size 1 k bytes, then the logical address should have13 bits14 bits15 bits16 bits