SDLC
32 bit vs 64 bit: Key Differences
What is 32-Bit? 32-bit is a type of CPU architecture which is capable of transferring 32 bits of...
Banker's Algorithm is used majorly in the banking system to avoid deadlock. It helps you to identify whether a loan will be given or not.
This algorithm is used to test for safely simulating the allocation for determining the maximum amount available for all resources. It also checks for all the possible activities before determining whether allocation should be continued or not.
For example, there are X number of account holders of a specific bank, and the total amount of money of their accounts is G.
When the bank processes a car loan, the software system subtracts the amount of loan granted for purchasing a car from the total money ( G+ Fixed deposit + Monthly Income Scheme + Gold, etc.) that the bank has.
It also checks that the difference is more than or not G. It only processes the car loan when the bank has sufficient money even if all account holders withdraw the money G simultaneously.
In this operating system tutorial, you will learn:
Here is an important notation used in Banker's algorithm:
[I: Y] indicate which resource is available.
[l:X,l: Y]: Expression of the maximum number of resources of type j or process i
[l:X,l:Y]. Indicate where process you have received a resource of type j
Express how many more resources can be allocated in the future
Assume that we have the following resources:
Here, we have created a vector representing total resources: Available = (5, 2, 4, 3).
Assume there are four processes. The available resources are already allocated as per the matrix table below.
| Process Name | Pen Drives | Printer | Scanner | Hard disk |
|---|---|---|---|---|
| P | 2 | 0 | 1 | 1 |
| Q | 0 | 1 | 0 | 0 |
| R | 1 | 0 | 1 | 1 |
| S | 1 | 1 | 0 | 1 |
| Total | 4 | 2 | 2 | 3 |
Here, the allocated resources is the total of these columns:
Allocated = (4, 2, 2, 3).
We also create a Matrix to display the number of each resource required for all the processes. This matrix is called Need=(3,0,2,2)
| Process Name | Pen Drives | Printer | Scanner | Hard disk |
|---|---|---|---|---|
| P | 1 | 1 | 0 | 0 |
| Q | 0 | 1 | 1 | 2 |
| R | 2 | 1 | 0 | 0 |
| S | 0 | 0 | 1 | 0 |
The available vector will be :
Available=Available- Allocated
= (5, 2, 4, 3) -(4, 2, 2, 3)
=(1, 0, 2, 0)
Resource request algorithm enables you to represent the system behavior when a specific process makes a resource request.
Let understand this by the following steps:
Step 1) When a total requested instance of all resources is lesser than the process, move to step 2.
Step 2) When a requested instance of each and every resource type is lesser compared to the available resources of each type, it will be processed to the next step. Otherwise, the process requires to wait because of the unavailability of sufficient resources.
Step 3) Resource is allocated as shown in the below given Pseudocode.
Available = Available – Request (y) Allocation(x) = Allocation(x) + Request(x) Need(x) = Need(x) - Request(x)
This final step is performed because the system needs to assume that resources have been allocated. So that there should be less resources available after allocation.
Here are important characteristics of banker's algorithm:
Here, are cons/drawbacks of using banker's algorithm
What is 32-Bit? 32-bit is a type of CPU architecture which is capable of transferring 32 bits of...
What is ClearQuest? IBM ClearQuest is a Bug Tracking system It provides change tracking, process...
SolarMovie is a website that allows you to watch movies online, free without any payment. The...
Wireless Keyboard and Mouse enables you to eliminate wires to make your workstation clean and...
Sites For Free Online Education helps you to learn courses at your comfortable place. The courses...
Download PDF 1) What are the important categories of software? System software Application...