Banker’s Algorithm - Safety Procedure
Local Data Structures:
- Work: vector [1..m], initialize Work to Available.
- Finish: vector[1..n], initialized to false for each process i.
1. Find process i such that Finish[ i ] = false and Needi ? Work
Work := Work + Allocationi
if Finish[ i ] = true for all i in 1..n, then the system is in a safe state. Otherwise, the processes whose index is false may potentially be involved in a deadlock in the future.