-> currently available resources
R0 R1 R2 R3
0 1 2 2
-> At this situation only process P1 get resources for its task completion because it still needs resources
R0 R1 R2 R3
0 0 2 0
which resources are available.So first Process P1 completes its task and then releases its resources after task completion.
-> next available resources
R0 R1 R2 R3
0+2 1+0 2+1 2+0
i.e
available resources
R0 R1 R2 R3
2 1 3 2
-> At this situation only process P4 get resources for its task completion because it still needs resources
R0 R1 R2 R3
2 0 0 2
which resources are available.So next Process P4 completes its task and then releases its resources after task completion.
-> now available resources
R0 R1 R2 R3
2+4 1+3 3+5 2+2
i.e
available total resources
R0 R1 R2 R3
6 4 8 4
-> At this situation only process P5 get resources for its task completion because it still needs resources
R0 R1 R2 R3
0 3 2 0
which resources are available.So next Process P5 completes its task and then releases its resources after task completion.
-> now available resources
R0 R1 R2 R3
6+2 4+3 8+3 4+0
i.e
available total resources
R0 R1 R2 R3
8 7 11 4
-> still the order of processes execution is P1->P4->P5
-> At this situation only process P2 get resources for its task completion because it still needs resources
R0 R1 R2 R3
0 7 5 0
which resources are available.So next Process P5 completes its task and then releases its resources after task completion.
-> now available resources
R0 R1 R2 R3
8+0 7+0 11+0 4+2
i.e
available total resources
R0 R1 R2 R3
8 7 11 6
-> finally P3 got all resources to complete its task.after completion of process P3 ...total avialble resources are
R0 R1 R2 R3
12 7 14 6
=> Execution Order is : P1->P4->P5->P2->P3
--------> if request from a process P1 arrives for (0, 4, 2, 0) at initial situation .the request can't be granted immediately,because avialable resources are less than required resources.So P1 doesnt granted immediately.
iii) If a request from a process P2 arrives for (0, 1, 2, 0) ...the request immediately granted because avialable resources are greater than required resources.
then Execution order is : P2 -> P1 -> P4 -> P5 -> P3 (similarily as above)