Banker’s Algorithm Calculator
The safety algorithm finishes processes whose needs fit what is free: Silberschatz’s example is safe, sequence ⟨P1, P3, P4, P0, P2⟩.
safe, sequence ⟨P1, P3, P4, P0, P2⟩
- Total resources
- 10 5 7
| Process | Allocation | Max | Need |
|---|---|---|---|
| P0 | 0 1 0 | 7 5 3 | 7 4 3 |
| P1 | 2 0 0 | 3 2 2 | 1 2 2 |
| P2 | 3 0 2 | 9 0 2 | 6 0 0 |
| P3 | 2 1 1 | 2 2 2 | 0 1 1 |
| P4 | 0 0 2 | 4 3 3 | 4 3 1 |
Step-by-step solution
- Work = Available = [3 3 2]; repeatedly pick a process whose Need ≤ Work and release its allocation
- P1: need [1 2 2] ≤ work → work = [5 3 2]
- P3: need [0 1 1] ≤ work → work = [7 4 3]
- P4: need [4 3 1] ≤ work → work = [7 4 5]
- P0: need [7 4 3] ≤ work → work = [7 5 5]
- P2: need [6 0 0] ≤ work → work = [10 5 7]
Banker’s Algorithm Formula
Need = Max − Allocation; run Pᵢ if Needᵢ ≤ Work
then Work = Work + Allocationᵢ
Worked Example
Silberschatz’s five processes and three resource types with Available (3, 3, 2):
- Work = Available = [3 3 2]; repeatedly pick a process whose Need ≤ Work and release its allocation
- P1: need [1 2 2] ≤ work → work = [5 3 2]
- P3: need [0 1 1] ≤ work → work = [7 4 3]
- P4: need [4 3 1] ≤ work → work = [7 4 5]
- P0: need [7 4 3] ≤ work → work = [7 5 5]
- P2: need [6 0 0] ≤ work → work = [10 5 7]
| Process | Allocation | Max | Need |
|---|---|---|---|
| P0 | 0 1 0 | 7 5 3 | 7 4 3 |
| P1 | 2 0 0 | 3 2 2 | 1 2 2 |
| P2 | 3 0 2 | 9 0 2 | 6 0 0 |
| P3 | 2 1 1 | 2 2 2 | 0 1 1 |
| P4 | 0 0 2 | 4 3 3 | 4 3 1 |
GATE tip
For a resource-request question, subtract the request from Available and Need, add it to Allocation, then run the safety check on the new state.
More Operating Systems Calculators
-
CPU Scheduling Calculator
TAT = completion − arrival, WT = TAT − burst
response = first run − arrival
Example: Four processes arriving at 0, 1, 2 and 3 with bursts 8, 4, 9 and 5 under SRTF: Average waiting time = 6.5.
-
Page Replacement Calculator
hit ratio = hits ÷ references
FIFO evicts the oldest, LRU the least recently used, Optimal the one used furthest ahead
Example: The reference string 7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1 with 3 frames: Page faults = 12.
-
Disk Scheduling Calculator
total movement = Σ |cylinderᵢ₊₁ − cylinderᵢ|
SCAN goes to the disk end; LOOK turns at the last request
Example: Requests 98, 183, 37, 122, 14, 124, 65, 67 with the head at 53 moving towards 0, SCAN: Total head movement = 236 cylinders.
-
Paging Calculator
page table size = 2^(VA − offset) × PTE
EAT = h(t + m) + (1 − h)(t + 2m)
Example: A 32-bit virtual address, 4 KB pages and 4-byte page table entries: Page table size = 4194304 bytes.
Frequently asked questions
Does an unsafe state mean deadlock?
No. An unsafe state may lead to deadlock; the Banker’s algorithm avoids it by refusing requests that would leave the system unsafe.
Can there be more than one safe sequence?
Yes. This calculator scans processes in order each pass, giving one valid sequence; others may exist.
Sources
Last reviewed: . Factors are stored exactly and computed with 50-digit decimal arithmetic. See how we verify conversion factors.
Cite this page
APA
Scientific Converters. (2026, October 15). Banker’s Algorithm Calculator. Retrieved October 25, 2026, from https://scientificconverters.com/calculators/bankers-algorithm-calculator/
IEEE
Scientific Converters, "Banker’s Algorithm Calculator," scientificconverters.com. Accessed: Oct. 25, 2026. [Online]. Available: https://scientificconverters.com/calculators/bankers-algorithm-calculator/