dijkstra bankers algorithm Algorithm

The Banker algorithm, sometimes referred to as the detection algorithm, is a resource allocation and deadlock avoidance algorithm developed by Edsger Dijkstra that tests for safety by simulating the allocation of predetermined maximal possible quantity of all resources, and then makes an" s-state" check to test for possible deadlock conditions for all other pending activity, before deciding whether allocation should be allowed to continue. 

When a new procedure enters a system, it must declare the maximal number of cases of each resource type that it may ever claim; clearly, that number may not exceed the total number of resources in the system.

dijkstra bankers algorithm source code, pseudocode and analysis