30-06-2012, 04:40 PM
Banker’s Algorithm
Banker’s Algorithm.ppt (Size: 209.72 KB / Downloads: 38)
The resource allocation graph is not applicable to a resource-allocation system with multiple instances of each resource type.
The new algorithm is not efficient than the resource allocation graph.
This algorithm is known as Banker’s algorithm.
This algorithm could be used in banking system to ensure that the bank never allocated its available cash in such a way that it could no longer satisfy the needs of its customer.
Data Structures for the Banker’s Algorithm
Several data structures must be maintained to implement the banker’s algorithm.
Let n = number of processes, and m = number of resources types.
Available: Vector of length m. If available [j] = k, there are k instances of resource type Rj available.
Max: n x m matrix. If Max [i,j] = k, then process Pi may request at most k instances of resource type Rj.
Allocation: n x m matrix. If Allocation[i,j] = k then Pi is currently allocated k instances of Rj.
Need: n x m matrix. If Need[i,j] = k, then Pi may need k more instances of Rj to complete its task.
Need [i,j] = Max[i,j] – Allocation [i,j].