0% found this document useful (0 votes)
13 views7 pages

Bankers Algorithm Example

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views7 pages

Bankers Algorithm Example

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

The Banker’s or Safety algorithm for finding out whether or not a system is in a safe

state can be described as follows:

• 1) Let Work and Finish be vectors of length ‘m’ and ‘n’ respectively.
Initialize: Work = Available
Finish[i] = false; for i=1, 2, 3, 4….n
• 2) Find an i such that both
a) Finish[i] = false
b) Needi <= Work
if no such i exists goto step (4)
• 3) Work = Work + Allocation[i]
Finish[i] = true
goto step (2)
• 4) if Finish [i] = true for all i
then the system is in a safe state
Bankers Algorithm Example
What will happen if process P1 requests one additional instance of
resource type A and two instances of resource type C?
• Characteristics of Banker's Algorithm
Here are important characteristics of banker's algorithm:
• Keep many resources that satisfy the requirement of at least one client
• Whenever a process gets all its resources, it needs to return them in a
restricted period.
• When a process requests a resource, it needs to wait
• The system has a limited number of resources
• Advance feature for max resource allocation
• Disadvantage of Banker's algorithm
Here, are cons/drawbacks of using banker's algorithm
• Does not allow the process to change its Maximum need while processing
• It allows all requests to be granted in restricted time.
• All processes must know and state their maximum resource needs in
advance.

You might also like