Banker’s Algorithm in Operating System

Banker’s Algorithm:

It is a deadlock avoidance algorithm that states that the name was chosen because the bank never allocates more than the available cash.

Available: A vector of length indicates the number of available resources of each type. If available [ j ]= k, there are k instances of resource type Rj available.

Max: An nxm matrix defines the maximum demand of each process. If max[ i,j ]=k, then Pi may request at most k instances of resources type Rj.

Allocation: An nxm matrix defines the number of resources of each type currently allocated to each process. If Allocation [ i,j ]=k, then process Pi currently allocated k instances of resources type Rj.

Need: An nxm matrix indicates the resources needed for each process. If Need [ i,j ]=k, then Pi may need k more instances of resource type Rj to complete its task.

[shell]
Need [ i,j ]= Max [ i,j ] – Allocation [ i,j ]
[/shell]