bankers algorithmin this


Banker's Algorithm

In this analogy

Customers

processes

Units

resources, say, tape drive

Banker

Operating System

 

Customers

Used

Max

 

A
B
C
D

0
0
0
0

6
5
4
7

Available Units = 10

 

 

 

 

 

 

 

 


We observe four customers each of whom has been granted a number of credit nits. The banker reserved only 10 units somewhat than 22 units to service them. At definite moment the situation becomes

Customers

Used

Max

 

A
B
C
D

1
1
2
4

6
5
4
7

Available Units = 2

 

 

 

 

 

 

 

 

Safe State-    The key to a state being secure is that there is at least one way for all users to finish. In other analogy the state of is safe because with 2 units left, the banker is able to delay any request except C's, therefore letting C finish and release all four resources. With four units in hand the banker is able to let either D or B have the necessary units and so on.

Unsafe State-     Consider what would take place if a request from B for one more unit were granted

We would have following situation

Customers

Used

Max

 

A
B
C
D

1
2
2
4

6
5
4
7

Available Units = 1

 

 

 

 

 

Fig. 3

 

 

This is an unsafe state.

If all the customers namely A, B, C, and D request for their maximum loans, then banker couldn't satisfy any of them and we would have a deadlock.

It is significant to note that an unsafe state does not imply the existence or even the eventual existence a deadlock. What an unsafe state does involve is simply that some unfortunate sequence of events might lead to a deadlock. The Banker's algorithm is therefore to consider each request as it occurs and see if granting it leads to a safe state. If it does, the request is granted or else, it postponed until later.

Request for Solution File

Ask an Expert for Answer!!
Operating System: bankers algorithmin this
Reference No:- TGS0307518

Expected delivery within 24 Hours