0% found this document useful (0 votes)
22 views2 pages

Understanding Banker’s Algorithm in OS

Banker's Algorithm is a deadlock avoidance method in Operating Systems that ensures resource allocation keeps the system in a safe state. It involves checking if resource requests can be satisfied without leading to an unsafe state, which could result in deadlock. The algorithm uses data structures to track available resources, maximum demand, current allocations, and remaining needs of processes.

Uploaded by

mamoonfareed20
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views2 pages

Understanding Banker’s Algorithm in OS

Banker's Algorithm is a deadlock avoidance method in Operating Systems that ensures resource allocation keeps the system in a safe state. It involves checking if resource requests can be satisfied without leading to an unsafe state, which could result in deadlock. The algorithm uses data structures to track available resources, maximum demand, current allocations, and remaining needs of processes.

Uploaded by

mamoonfareed20
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

BANKER’s ALOGORITHM

Banker’s Algorithm is a deadlock avoidance algorithm used in


Operating Systems.
It checks whether allocating requested resources to a process will
keep the system in a safe state or not.
 If the system remains safe → resources are allocated
 If unsafe → allocation is denied (process must wait)

Data Structures Used


Name Meaning
Free
Available
resources
Maximum
demand of
Max
each
process
Currently
Allocation allocated
resources
Remaining
Need resources
needed
Need = Max – Allocation
How Banker’s Algorithm Works (Steps)
1. When a process requests resources
2. OS checks:
o Request ≤ Need
o Request ≤ Available
3. Temporarily allocate resources
4. Check for safe sequence
5. If safe → grant request
If unsafe → rollback allocation
Safe State
A system is in a safe state if there exists a safe sequence of
processes such that:
Each process can finish using:
 Currently available resources
 Resources released by previously completed processes
Unsafe State in Operating Systems?
An unsafe state is a system state in which no safe sequence exists
for the execution of processes.
This means:
 The OS cannot guarantee that all processes will complete
 The system may lead to deadlock, but deadlock has not
occurred yet

You might also like