I'm a bit confused about this question:

"Multiple jobs can run in parallel and finish faster than if they had run sequentially. Suppose that two jobs, each needing 10 minutes of CPU time, start simultaneously. How long will the last one take to complete if they run sequentially? How long if they run in parallel? Assume 50% I/O wait."

Answer from textbook (Modern Operating Systems 4th edition by Tanenbaum)

"If each job has 50% I/O wait, then it will take 20 minutes to complete in the absence of competition. If run sequentially, the second one will finish 40 minutes after the first one starts. With two jobs, the approximate CPU utilization is 1 − 0.52. Thus each one gets 0.375 CPU minute per minute of real time. To accumulate 10 minutes of CPU time, a job must run for 10/0.375 minutes, or about 26.67 minutes. Thus running sequentially the jobs finish after 40 minutes, but running in parallel they finish after 26.67 minutes."

I don't understand why it will take 20 minutes for each job to complete if the IO wait time is 50%. Doesn't that just mean 5 minutes of CPU time is spent waiting for I/O?

  • 3
    $\begingroup$ It is saying (in an admittedly confusing way) that 50% of the time the program is waiting for I/O. If you run one program, it will take $10 / 0.5 = 20$ minutes. $\endgroup$ – vonbrand Jan 4 '16 at 12:19

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(ANSWER)

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.