the completion time of process p2 is 20 units
To determine the completion time of process p2, let's analyze the execution timeline for all three processes:
Process | Total Execution Time | I/O Time (20%) | Computation Time (70%) | I/O Time (10%)
P1 | 10 units | 2 units | 7 units | 1 unit
P2 | 20 units | 4 units | 14 units | 2 units
P3 | 30 units | 6 units | 21 units | 3 units
P2 starts its computation burst, and P1 continues its computation burst simultaneously. After 7 units, P1 completes its computation burst and enters its final I/O burst. P2 continues its computation burst until it reaches the 14-unit mark, at which point it also enters its final I/O burst.
While P1 and P2 are doing I/O, P3 arrives and enters its first I/O burst. Once P1 and P2 complete their I/O bursts, they become eligible for execution again. P3 completes its first I/O burst and begins its computation burst.
P2's computation burst is shorter than P1's, so it finishes first and enters its final I/O burst. P1 continues its computation burst until it finishes, and P3 continues its computation and final I/O bursts.
all three processes complete their execution.
The completion time of process p2 can be calculated by adding up its I/O and computation times:
Completion time of P2 = I/O time (20%) + Computation time (70%) + I/O time (10%)
Completion time of P2 = 4 units + 14 units + 2 units
Completion time of P2 = 20 units
Therefore, the completion time of process p2 is 20 units.