The image in the question follows the correct order which is:
P1 → P2 → P5 → P3 → P4
Explanation:
P1
is arrived at time = 0
, so it will be executed first. Service Time of this process is 3
. So this process is completed at time=3
.
At time=3
, there is only one process that is arrived which is P2
. All other processes arrive later. So this process is now executed. Service time of this process is 6
, so this process is completed at time=3+6=9
.
Now at time=9
, there are three processes which are P3
, P4
and P5
(which arrived at time= 4, 6 and 8
respectively). Since the service time of P5
is 2
which is minimum as compared to that of P3
and P4
, so P5
is now executed and it gets completed at time=9+2=11
.
At time=11
, we have two processes which are P3
and P4
(which are arrived at time= 4 and 6
respectively). Since the service time of P3
is 4
which is less as compared to that of P4
, so P4
is executed now and it gets completed at time= 11+4=15
At time=15
, we have only one process which is P4
. So it is executed now. Since service time of this process is 5
, so it gets completed at time = 15+5 = 20