Should this request be granted?
The situation
A system has 10 units of one resource and three processes.
| Process | Allocated | Maximum need | |---|---|---| | P0 | 3 | 9 | | P1 | 2 | 4 | | P2 | 2 | 7 |
So 7 units are allocated and 3 are available.
The Banker's algorithm asks whether there is an order in which every process can finish: give a process what it still needs, let it run to completion, reclaim everything it held, and repeat. A state is safe if such an order exists.
From the original state, P0 requests 2 more units.
Granting it would leave P0 with 5 allocated, needing 4 more, and 1 unit available.
Should the Banker's algorithm grant it?