INTRODUCING

IMAN KIANIAN


The banker’s algorithm is a resource allocation and deadlock avoidance algorithm that tests for safety by simulating the allocation for predetermined maximum possible amounts of all resources, then makes an “s-state” check to test for possible activities, before deciding whether allocation should be allowed to continue.Banker’s algorithm is named so because it is used in banking system to check whether loan can be sanctioned to a person or not. Suppose there are n number of account holders in a bank and the total sum of their money is S. If a person applies for a loan then the bank first subtracts the loan amount from the total money that bank has and if the remaining amount is greater than S then only the loan is sanctioned. It is done because if all the account holders comes to withdraw their money then the bank can easily do it. In other words, the bank would never allocate its money in such a way that it can no longer satisfy the needs of all its customers. The bank would try to be in safe state always.

My Project file (Banker.zip) consist two .py files. First one is Banker.py . This file is Banker project with GUI And import Data from .Csv files. Second one is BankerCLI.py. The platform used to design the GUI is PyQt5. This File is Banker Project in CLI Mode. There are two example tests in codes (you can use your own data). First one is :

Resource=[9,3,6]

Max=[[6,2,2],[6,1,3],[3,1,4],[4,2,2]]

Allocation=[[1,0,0],[6,1,2],[2,1,1],[0,0,2]]

And its Result in Banker.py is:

Second Example is :

Resource=[14,7]

Max=[[9,5],[2,6],[2,2],[5,0]]

Allocation=[[7,2],[1,3],[1,1],[3,0]]

And its Result in Banker.py is:

You can download my banker project file by clicking the button below.