1. THE BANKER'S ALGORITHM FOR A
SINGLE RESOURCE
• It is modeled on the way a small-town banker might deal with a
group of customers to whom he has granted lines of credit. What the
algorithm does is check to see if granting the request leads to an
unsafe state. If it does, the request is denied. If granting the request
leads to a safe state, it is carried out. In Fig. (a) we see four
customers. A, B, C and D, each of whom has been granted a cerwain
number of credit units. The banker knows that not all customers will
need their maximum credit immediately, so he has reserved only 10
units rather than 22 to service them. (In this analogy, customers are
processes, units are, say, tape drives, and the banker is the operating
system.)
Has Max
Has Max
Has Max
A 0 6
A 1 6
A 1 6
B 0 5
B 1 5
B 2 5
C 0 4
C 2 4
C 2 4
D 0 7
D 4 7
D 4 7
Free: 10
Free: 2
Free: 1
(a)
(b)
(c)
\text{cation states: (a) Safe. (b) Safe (c) Unsafe.}