What is bankers algorithm

what is bankers algorithm

(Dijkstra, 1965)

                3

              5

Process C

                5

              7

  • The number of available tape drives is reduced to one (1).
  • No process can be granted enough tape drives to complete.
  • This means that there will be no safe sequences possible, if we grant Process C's request.
  • Thus, granting this request will take us from a safe state to an unsafe state.
According to Deitel: "An unsafe state does not imply the existence of deadlock. What an unsafe state does imply is simply that some unfortunate sequence

of events might lead to deadlock." The Banker's algorithm: Allows:

  • mutual exclusion
  • wait and hold
  • no preemption
Prevents:
  • circular wait

User process may only request one resource at a time.

System grants request only if the request will result in a safe state. The Banker's algorithm: An Example

Assume we have the following resources:
  • 5 tape drives
  • 2 graphic displays
  • 4 printers
  • 3 disks
We can create a vector representing our total resources: Total = (5, 2, 4, 3).

Consider we have already allocated these resources among four processes as demonstrated by the following matrix named Allocation.

Process Name    

Source: www.cs.colostate.edu

Category: Bank

Similar articles: