Observe a single processor system that has two supporting running processes, A a
ID: 3878513 • Letter: O
Question
Observe a single processor system that has two supporting running processes, A and B, with the following sequential execution patterns:
A: [CPU 8 ms; IO 1 ms; CPU 8 ms; IO 1 ms; CPU 8 ms]
B: [CPU 2 ms; IO 1 ms; CPU 2 ms; IO 1 ms; CPU 2 ms]
Assume that IO operations do not interfere with each other and are blocking, and that
scheduling and context switch times are negligible.
What is the total elapsed time for the two processes to run to completion?
Explanation / Answer
The total run time depends on the type of scheduling.
If B starts only after A has finished its entire running:
Time taken for A = 8+1+8+1+8 = 26ms
Time taken for B = 2+1+2+1+2 = 8ms
Total time taken = A+B = 26+8 = 34ms
But if B is scheduled when A switches context for IO operations, then CPU will not be idle and the scheduling will be:
A(8ms)-B(2ms)-A(8ms)-B(2ms)-A(8ms)-B(2ms)
When A goes for IO, B is scheduled and when B goes for IO, A is scheduled. Since IO operations take only 1ms of time, the processes stay in wait state for the other process to complete it's CPU time.
In this case, Total time taken (A and B) = 8+2+8+2+8+2 = 30ms
Hope this helps. Do Upvote! :)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.