The Banker’s Algorithm
Banker’s algorithm decides whether to grant a resource request. Define data structures.
n: integer # of processes
m: integer # of resources
available[1..m] avail[i] is # of avail resources of type i
max[1..n,1..m] max demand of each Pi for each Ri
allocation[1..n,1..m] current allocation of resource Rj to Pi
need[1..n,1..m] max # of resource Rj that Pi may still request
let request[i] be a vector of the # of instances of resource Rj that Process Pi wants.