Banker's algorithm: Difference between revisions

m
added whitespace.
(Banker's algorithm en Yabasic)
m (added whitespace.)
Line 1:
{{draft task|Classic CS problems}}{{Wikipedia|Banker's algorithm}}
{{Wikipedia|Banker's algorithm}}
 
 
The '''Banker's algorithm''' is a [[wp:resource allocation|resource allocation]] and [[wp:deadlock|deadlock]] avoidance [[wp:algorithm|algorithm]] developed by [[wp:Edsger Dijkstra|Edsger Dijkstra]] that tests for safety by simulating the allocation of predetermined maximum possible amounts of all [[wp:resource (computer science)|resources]], and then makes a "s-state" check to test for possible deadlock conditions for all other pending activities, before deciding whether allocation should be allowed to continue.
 
==== Example input ====
 
Assuming that the system distinguishes between four types of resources, (A, B, C and D), the following is an example of how those resources could be distributed. ''Note that this example shows the system at an instant before a new request for resources arrives. Also, the types and number of resources are abstracted. Real systems, for example, would deal with much larger quantities of each resource.''
==== ;Example input ====:
Assuming that the system distinguishes between four types of resources, (A, B, C and D), the following is an example of how those resources could be distributed. ''Note that this example shows the system at an instant before a new request for resources arrives. Also, the types and number of resources are abstracted. Real systems, for example, would deal with much larger quantities of each resource.''
 
Also, the types and number of resources are abstracted.   Real systems, for example, would deal with much larger quantities of each resource.''
 
Total resources in system:
Line 30 ⟶ 37:
P2 0 2 0 1
P3 0 1 4 0
<br><br>
 
=={{header|C}}==