The correct option is
D 10, 15, 9
At t = 0 only P1 is present so execute it for 1 unit (
remaining CPU time of P1 = 0, now it will perform I/O).
At t = 1 no process is available for CPU so CPU will remain idle and P1 will perform I/O
(
remaining I/O time of P1 = 4)
At t = 2 P2 arrives and is available for CPU so execute it for 1 unit and simultaneously P1 will do I/O (
remaining CPU time of P2=2 and remaining I/O time of P1 = 3).
At t = 3 P3 also arrives and it is having highest priority among all processes available for CPU so we can execute P3 for its complete CPU burst (i.e. 2 unit) as all processes has arrived and simultaneously P1 will do I/O (
remaining CPU time of P3 = 0, now P3 will perform I/O & remaining I/O time of P1 = 1).
At t = 5 only P2 is available for CPU so it will execute for 1 unit and P1 and P3 will perform I/O (
remaining CPU time of p2=1, remaining I/O time of P3 = 2, remaining I/O time of P1 = 0, now P1 will perform CPU)
At t = 6 P2 and P1 are available for CPU but P1 will be selected because it is having highest priority then P2 so execute P1 for 1 unit (
remaining CPU time of P1 = 2 & remaining I/O time of P3 is 1)
At t = 7 again P1 will be executed for 1 unit (
remaining CPU time of P1 = 1 and remianing I/O time of P3 = 0, now P3 will perform CPU).
At t = 8 now P1, P2 & P3 are available for CPU so P3 will be selected based on highest priority and will be executed for 1 unit (
remaining CPU time of P3 = 0, so P3 completed at t = 9).
At t = 9 P1 will be executed on CPU for 1 unit (
remaining CPU time of P1 = 0, so P1 completed at t = 10).
At t = 10 only P2 is available for CPU so it will execute its remaining CPU burst (i.e. 1 unit) (
remaining CPU time of P2 = 0, now P2 will perform I/O.)
At t = 11 P2 will perform I/O for 3 units and CPU will remain IDLE.
At t = 14 P2 will perform CPU again and
P2 is completed at t = 15
P1 |
IDLE |
P2 |
P3 |
P2 |
P1 |
P1 |
P3 |
P1 |
P2 |
IDLE |
P2 |
0 |
1 |
2 |
3 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
14 15 |