Banker's Safety Algorithm
Test resource availability against remaining process claims and distinguish a safe completion order from an unsafe state.
Free theory articleTest resource availability against remaining process claims and distinguish a safe completion order from an unsafe state.
Concept & interpretation
Dijkstra's Banker's Safety Algorithm tests whether a multi-resource operating system state admits at least one safe completion sequence in which every process can acquire its remaining maximum claim Needi = Maximumi - Allocationi, finish execution, and return its currently allocated resources to the working pool.
Experiment
Test safe chains and unsafe resource shortages in https://riano.app/module/bankers-safety-algorithm:
- Select scenario Chain, set Available R1 to 2 and Available R2 to 0, and click Step three times to see P2 finish first (releasing 2 units of R2), unlocking P1 and then P3 for sequence
["P2", "P1", "P3"]. - Reduce Available R1 to 0 and Available R2 to 0 in Shared or Chain and click Finish to observe
Unsafe (not proof of current deadlock). - Switch to No claims with Available = (0, 0) to confirm that when Need = (0, 0) for all processes, all three finish immediately even with zero free resources.