Processes p1 and p2 execute on a system with a single CPU
and 2 identical I/O devices. Each process executes a compute-bound phase
followed by an I/O-bound phase. The system uses multiprogramming without
time-sharing. The following table shows the lengths of each phase.
Compute |
I/O |
|
p1 |
10 |
70 |
p2 |
40 |
80 |
p1 starts first at time 0.
Without multiprogramming, the computation terminates at time ??????
With multiprogramming, the computation terminates at time ?????
Expected: 200, 130
p1 needs 10 + 70 = 80 time units and p2 needs 40 + 80 = 120
time units. Without multiprogramming, the processes execute in sequence for a
total of 80 + 120 = 200 time units.
With multiprogramming, p1 runs from 0 to 10, followed by the
I/O phase from 10 to 80. p2 starts as soon as p1's compute phase terminates and
runs from 10 to 50, followed by the I/O phase from 50 to 130.
With multiprogramming, the compute phases are sequential
because only 1 CPU is available, but the I/O phases can overlap since 2 I/O
devices are available.
No comments:
Post a Comment