BANKER'S AlGORITHM

Banker's Algorithm


Theory :

There sometimes comes a situation of deadlock in OS where a set of processes are blocked because it is holding a resource and also requires some other resources at the same time that are being acquired by other processes. So, to avoid such a situation of deadlock, we have the Bankers algorithm in Operating System. The Banker’s Algorithm in OS 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. It was designed by Edsger Dijkstra. As the name suggests, Banker’s algorithm in OS is mostly used in the banking systems to identify whether a loan should be sanctioned to a person or not.
Banker’s algorithm consists of Safety Algorithm and Resource Request Algorithm.

1] Safety Algorithm :
This algorithm for finding out whether a system is in a safe state or not.

2] Resource Request Algorithm :
This algorithm checks how a system will behave when a process makes each type of resource request in a system as a request matrix.

Characteristics of FCFS :

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.

Advantages :

It contains various resources that meet the requirements of each process.
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.
It helps the operating system manage and control process requests for each type of resource in the computer system.
The algorithm has a Max resource attribute that represents indicates each process can hold the maximum number of resources in a system.

Disadvantages :

It requires a fixed number of processes, and no additional processes can be started in the system while executing the process.
The algorithm does no longer allows the processes to exchange its maximum needs while processing its tasks.
Each process has to know and state their maximum resource requirement in advance for the system.
The number of resource requests can be granted in a finite time, but the time limit for allocating the resources is one year.