Operating Systems
Banker's Algorithm Simulator
Simulate Banker's Algorithm to detect safe states, analyze resource allocation and prevent deadlock in Operating Systems.
Safe State Analyzer
Visualize resource allocation and safe sequence execution.
Allocation
Resources currently assigned to each process.
Maximum
Maximum resources required by processes.
Need Matrix
Remaining resources needed for completion.
Safe Sequence
Execution order that avoids deadlock.
Available Resources
System is Safe
A safe sequence exists. No deadlock will occur.
Final Available Resources
Banker's Algorithm Table
| Process | Allocation | Maximum | 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 |
Safe Sequence
Step-by-Step Simulation
Step 1
Execute P1
Before
After
Step 2
Execute P3
Before
After
Step 3
Execute P4
Before
After
Step 4
Execute P0
Before
After
Step 5
Execute P2
Before
After
How Banker's Algorithm Works
Banker's Algorithm checks whether granting a resource request keeps the system in a safe state.
The algorithm calculates Allocation, Maximum, Available and Need matrices to determine if all processes can finish successfully.
If a safe sequence exists, the system avoids deadlock and continues execution safely.