What
-
A resource allocation and deadlock avoidance algorithm developed by Edsger Dijkstra
-
Idea: First give resources to those need less resources, like a Greedy algorithm.
-
We need to know the available resources, resources needed and available.
-
If safe, we give, then recycle the resources from the finished process.
How
- Ask the maximum resources they will need.
- Then, when a client requests resources, the bank tentatively grants this.
- It then checks to see if, after this grant, it can still fulfill the maximum potential request from all clients.
- If it can, it permanently grants the request.
- If it can’t, it refuses the request and waits until more resources become available.
- By doing this, the bank ensures that it never enters a state where it can’t fulfill all its commitments, avoiding deadlock situations.