Is there a safe sequence?
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.
With 3 units available and needs of 6, 2 and 5, is the state safe?