Banker's algorithm

Banker's algorithm

Creator
Created
Created
2019 Nov 5 5:17
Editor
Edited
Edited
2023 Nov 19 16:9
Refs
Refs
Deadlock

It is Deadlock Avoidance itself

Define a set of vectors and matrices that characterize the current state of all resources and processes
Each process must a priori claim maximum use
 

DataStructure

  • n - process number, m resource type number.
  • Available : one dimension array of length m - store available resources number by resource type
  • Max (require to retire process): two dimension array of m x n - process i require j type and express it by max[i,j]
  • Allocation : two dimension array of m x n - how much allocated - allocation[i,j]
  • Need : two dimension array of m x n - (Need = Max - Allocation) how much more need
 

Banker's algorithm is function of input Request

Request_i : one dimension array of length m - request vector for process Pi
notion image

Safety Algorithm

Work(copy of Available) and Finish(initialized false for all process) be vectors of length m and n, respectively → fine sequence of execution

Result is no → process must wait

 

Difference

All tow algorithm is Deterministic Algorithm but Banker's is determine for Allocation
Detection is determine of checking deadlock
  • Banker's Algorithm is virtual verification of unassigned resource by simulation
  • Detection Algorithm is check stage is safe or not
 
 
 
 

Recommendations