The Banker’s Algorithm

The Banker’s algorithm is one of the most commonly used algorithms even until today. Based on its namesake, it’s an algorithm that’s highly useful in a bank’s setting. Why? It helps manage their resources and ensures that they are properly allocated.

It works this way. When a customer makes a withdrawal or requests for a loan, the bank staff will input the figure and run the algorithm. The algorithm, in turn, will assess whether the bank is capable of providing the funds. And by capable, we mean that removing that amount from the system will not endanger the position of the bank. If it is alright then, the funds will be given to the customer. It’s an algorithm used to ensure the security and stability of the bank’s operations.

This algorithm is pretty simple in the sense that it needs to know three essential elements – the available balance, the allocated allowance and the maximum request of the customer. The funds can only be withdrawn if the request is both less than the available balance and maximum possible request of all the other customers. If these conditions are not satisfied then, the customer has to wait for others to deposit their funds before he or she can process his or her request again. In short, that customer will be on the wait list.

The primary goal of the algorithm is to determine whether the request will allow the bank to remain in the safe state or will it cause the bank to go to an unsafe state. By safe state, we mean that all other processes will be completed. This is practical since hundreds and thousands of customers flock to the bank on a daily basis. If one customer’s request will lead to the bank being unable to serve the rest of its clients then, it’s really quite impractical to process that request. But an algorithm wouldn’t know how many people will come in for the day nor will it know just how much will be requested by the others. Therefore, the algorithm assumes that the totality of the requests of everyone will equal the maximum available balance.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s