0% found this document useful (0 votes)
11 views

bankers algorithm

The Banker's algorithm is a resource allocation and deadlock avoidance method used by a bank to manage loan requests from account holders, ensuring that future withdrawals can be met without operational issues. It requires processes to declare their maximum resource needs in advance and checks for potential deadlocks before granting resources. However, it has disadvantages such as the need for a fixed number of processes, complexity in management, and limitations on resource requests and exchanges during execution.

Uploaded by

Akshat
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

bankers algorithm

The Banker's algorithm is a resource allocation and deadlock avoidance method used by a bank to manage loan requests from account holders, ensuring that future withdrawals can be met without operational issues. It requires processes to declare their maximum resource needs in advance and checks for potential deadlocks before granting resources. However, it has disadvantages such as the need for a fixed number of processes, complexity in management, and limitations on resource requests and exchanges during execution.

Uploaded by

Akshat
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Real Life Example (Bankers algorithm)

Imagine having a bank with T amount of money and n account holders. At some point, whenever one
of the account holders requests a loan:

o The bank withdraws the requested amount of cash from the total amount available for any
further withdrawals.

o The bank checks if the cash that is available for withdrawal will be enough to cater to all
future requests/withdraws.

o If there is enough money available (that is to say, the available cash is greater than T), he
lends the loan.

o This ensures that the bank will not suffer operational problems when it receives subsequent
applications.

o Advantages
o Following are the essential characteristics of the Banker's algorithm:
o
o It contains various resources that meet the requirements of each process.
o Each process should provide information to the operating system for
upcoming resource requests, the number of resources, and how long the
resources will be held.
o It helps the operating system manage and control process requests for each
type of resource in the computer system.
o The algorithm has a Max resource attribute that represents indicates each
process can hold the maximum number of resources in a system.
o It means that in the Banker's Algorithm, the resources are granted only if
there is no possibility of a deadlock when those resources are to be assigned.
Thus, it ensures that the system runs at optimal performance.

Disadvantages

1. It requires a fixed number of processes, and no additional processes can be started in the
system while executing the process.

2. The algorithm does no longer allows the processes to exchange its maximum needs while
processing its tasks.

3. Each process has to know and state their maximum resource requirement in advance for the
system.

4. The number of resource requests can be granted in a finite time, but the time limit for
allocating the resources is one year.

5. It could be pretty intricate to manage the algorithm, which is especially known in the case of
systems with a vast quantity of processes and resources. This, consequently, translates to
increased overhead.

When working with a banker's algorithm, it requests to know about three things:
1. How much each process can request for each resource in the system. It is denoted by the
[MAX] request.

2. How much each process is currently holding each resource in a system. It is denoted by the
[ALLOCATED] resource.

3. It represents the number of each resource currently available in the system. It is denoted by
the [AVAILABLE] resource.

You might also like