SlideShare a Scribd company logo
3
Most read
4
Most read
9
Most read
Karam Butt
DEADLOCK AVOIDANCE
Contents
 Deadlock Avoidance
 Safe state
 Unsafe state
 Resource allocation graph algorithm
 Banker’s Algorithm
Deadlock Avoidance
 Deadlock avoidance is a technique used to avoid
deadlock.
 It requires information about how different processes
would request different resources.
 Safe state: if deadlock not occur then safe state.
 Unsafe state: if deadlock occur then unsafe state.
 The idea of avoiding a deadlock is simply not allow the
system to enter an unsafe state the may cause a
deadlock.
Resource Allocation Graph
Algorithim
 Claim edge: used to indicate that process may request a
resource in future..
 It represented by dashed lined.
 Claim edge converts to Assignment edge when a process
requests a resource.
 Assignment Edge is represented by solid line.
 When a resource is released by a process, assignment edge
reconverts to a claim edge.
Example Resource-Allocation Graph For Deadlock
Avoidance
 Safe state:
Example Resource-Allocation Graph For Deadlock
Avoidance
 Unsafe
Banker’s Alghorithum
 Multiple instances.
 Each process must a priori claim maximum use.
 When a process requests a resource it may have to
wait.
 When a process gets all its resources it must return
them in a finite amount of time.
Example Banker’s Algorithm
Example: If we
Process A B C D
P1 2 0 1 1
P2 0 1 0 0
P3 1 0 1 1
P4 1 1 0 1
Allocation Matrix
Available
resource(5,2,4,3)
Allocation resources
(4,2,2,3)
Need matrix
Process A B C D
P1 1 1 0 0
P2 0 1 1 2
P3 3 1 0 0
P4 0 0 1 0
Solve the Example
 Available free resources=Available resource –Allocated
resources
Available free resources=(5,2,4,3)-(4,2,2,3)
Available free resources=(1,0,2,0)
Working of Banker’s Algorithm:
Need Resources <=Available free Resources(when
the condition is satisfied then processes in safe state
otherwise not.)
For p1: (1,1,0,0)<=(1,0,2,0)
Unsafe state (not Available)
Continue………
 For p2: (0,1,1,2)<=(1,0,2,0)
Unsafe(Not Available)
 For p3: (3,,1,0,0)<=(1,0,2,0)
Unsafe(Not Available)
For p4: (0,,0,1,0)<=(1,0,2,0)
(Available) Safe
Now the process p4 complete, it will turn over currently
allocated resources ,incrementing the available free
resources..
 Updated value of Available Resource=Current
value of available Resources + Allocated resources
of Allocated matrix
Need process(p1)=(1,1,0,0)<=(2,1,2,1) Available
Now p1 is complete, it will turn over currently allocated
resources ,incrementing the available free resources..
(1.1,0,1) Allocation of process(p4)
(2,1,2,1) updated value of Available
(2,1,2,1) Current value of Available
(2,0,1,1) Allocation process (P1)
(4,1,3,2) Updated value of Available

More Related Content

PPTX
Message passing in Distributed Computing Systems
PPTX
Bankers algorithm
PPTX
linked list
PPTX
Deadlocks in operating system
PPTX
Deadlock ppt
PPTX
Semophores and it's types
PDF
Deadlock Avoidance - OS
PPTX
CPU Scheduling in OS Presentation
Message passing in Distributed Computing Systems
Bankers algorithm
linked list
Deadlocks in operating system
Deadlock ppt
Semophores and it's types
Deadlock Avoidance - OS
CPU Scheduling in OS Presentation

What's hot (20)

PPT
Disk scheduling
PPTX
Deadlock Prevention
PPT
Deadlock in operating systems
PPTX
DeadLock in Operating-Systems
PDF
Process scheduling (CPU Scheduling)
PPT
deadlock avoidance
PPTX
Critical section problem in operating system.
PPTX
Tree - Data Structure
PPTX
Cpu scheduling in operating System.
PPT
Scheduling algorithms
PPTX
Lock based protocols
PPTX
Graph coloring using backtracking
PPTX
SCHEDULING ALGORITHMS
PPT
Pipeline hazards in computer Architecture ppt
PPT
Thrashing allocation frames.43
PPTX
Threads .ppt
PPT
POST’s CORRESPONDENCE PROBLEM
PPTX
Methods for handling deadlock
PPTX
Message and Stream Oriented Communication
Disk scheduling
Deadlock Prevention
Deadlock in operating systems
DeadLock in Operating-Systems
Process scheduling (CPU Scheduling)
deadlock avoidance
Critical section problem in operating system.
Tree - Data Structure
Cpu scheduling in operating System.
Scheduling algorithms
Lock based protocols
Graph coloring using backtracking
SCHEDULING ALGORITHMS
Pipeline hazards in computer Architecture ppt
Thrashing allocation frames.43
Threads .ppt
POST’s CORRESPONDENCE PROBLEM
Methods for handling deadlock
Message and Stream Oriented Communication
Ad

Viewers also liked (20)

PDF
Unsafe SSL webinar
PPT
Are you as safe as you think
PPT
Operating System Deadlock Galvin
PPT
Dead Lock
PPT
Mca ii os u-3 dead lock & io systems
PDF
Intro to Deadlocks
PPT
Ch8 OS
 
PPT
Deadlocks
PDF
DOCX
Banker's note - Blackstone Synergy Pitch
PPT
Introduction to Operating system
PPSX
Deadlock_SVVSDM_DWD
PDF
OS - Deadlock
PPT
Lecture5
PDF
2009 Punjab Technical University B.C.A OPERATING SYSTEM Question paper
PPT
Operating System: Deadlock
PDF
Chapter 8 software testing
PDF
Holography
PPTX
Handling data 1
Unsafe SSL webinar
Are you as safe as you think
Operating System Deadlock Galvin
Dead Lock
Mca ii os u-3 dead lock & io systems
Intro to Deadlocks
Ch8 OS
 
Deadlocks
Banker's note - Blackstone Synergy Pitch
Introduction to Operating system
Deadlock_SVVSDM_DWD
OS - Deadlock
Lecture5
2009 Punjab Technical University B.C.A OPERATING SYSTEM Question paper
Operating System: Deadlock
Chapter 8 software testing
Holography
Handling data 1
Ad

Similar to Operating system Dead lock (20)

PDF
Deadlock
PPT
Operating System
PDF
CH07.pdf
PPTX
Gp1242 007 oer ppt
PDF
Chapter 5(five).pdf
PPT
PPT
PPT
Chapter 7 - Deadlocks
PPTX
Deadlock
PPT
Deadlock principles in operating systems
PPTX
Deadlock - An Operating System Concept.pptx
PPT
Module-2Deadlock.ppt
PPTX
Deadlock and avoidance in Operating System.pptx
PPTX
bankers algorithm in operating system.pptx
PPTX
OSLec14&15(Deadlocksinopratingsystem).pptx
PPTX
Chapter 6 - Operating System Deadlock.pptx
PPTX
Deadlock
PPT
A ppt on deadlock in operating systems for the better explanation
PPT
Principles of Operating system and types
Deadlock
Operating System
CH07.pdf
Gp1242 007 oer ppt
Chapter 5(five).pdf
Chapter 7 - Deadlocks
Deadlock
Deadlock principles in operating systems
Deadlock - An Operating System Concept.pptx
Module-2Deadlock.ppt
Deadlock and avoidance in Operating System.pptx
bankers algorithm in operating system.pptx
OSLec14&15(Deadlocksinopratingsystem).pptx
Chapter 6 - Operating System Deadlock.pptx
Deadlock
A ppt on deadlock in operating systems for the better explanation
Principles of Operating system and types

Recently uploaded (20)

PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PPTX
ai tools demonstartion for schools and inter college
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
AI in Product Development-omnex systems
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
history of c programming in notes for students .pptx
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
System and Network Administraation Chapter 3
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
L1 - Introduction to python Backend.pptx
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
How Creative Agencies Leverage Project Management Software.pdf
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
ai tools demonstartion for schools and inter college
Navsoft: AI-Powered Business Solutions & Custom Software Development
Which alternative to Crystal Reports is best for small or large businesses.pdf
Operating system designcfffgfgggggggvggggggggg
AI in Product Development-omnex systems
How to Choose the Right IT Partner for Your Business in Malaysia
history of c programming in notes for students .pptx
Wondershare Filmora 15 Crack With Activation Key [2025
ManageIQ - Sprint 268 Review - Slide Deck
Upgrade and Innovation Strategies for SAP ERP Customers
System and Network Administraation Chapter 3
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Softaken Excel to vCard Converter Software.pdf
L1 - Introduction to python Backend.pptx
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus

Operating system Dead lock

  • 2. DEADLOCK AVOIDANCE Contents  Deadlock Avoidance  Safe state  Unsafe state  Resource allocation graph algorithm  Banker’s Algorithm
  • 3. Deadlock Avoidance  Deadlock avoidance is a technique used to avoid deadlock.  It requires information about how different processes would request different resources.  Safe state: if deadlock not occur then safe state.  Unsafe state: if deadlock occur then unsafe state.  The idea of avoiding a deadlock is simply not allow the system to enter an unsafe state the may cause a deadlock.
  • 4. Resource Allocation Graph Algorithim  Claim edge: used to indicate that process may request a resource in future..  It represented by dashed lined.  Claim edge converts to Assignment edge when a process requests a resource.  Assignment Edge is represented by solid line.  When a resource is released by a process, assignment edge reconverts to a claim edge.
  • 5. Example Resource-Allocation Graph For Deadlock Avoidance  Safe state:
  • 6. Example Resource-Allocation Graph For Deadlock Avoidance  Unsafe
  • 7. Banker’s Alghorithum  Multiple instances.  Each process must a priori claim maximum use.  When a process requests a resource it may have to wait.  When a process gets all its resources it must return them in a finite amount of time.
  • 8. Example Banker’s Algorithm Example: If we Process A B C D P1 2 0 1 1 P2 0 1 0 0 P3 1 0 1 1 P4 1 1 0 1 Allocation Matrix Available resource(5,2,4,3) Allocation resources (4,2,2,3)
  • 9. Need matrix Process A B C D P1 1 1 0 0 P2 0 1 1 2 P3 3 1 0 0 P4 0 0 1 0
  • 10. Solve the Example  Available free resources=Available resource –Allocated resources Available free resources=(5,2,4,3)-(4,2,2,3) Available free resources=(1,0,2,0) Working of Banker’s Algorithm: Need Resources <=Available free Resources(when the condition is satisfied then processes in safe state otherwise not.) For p1: (1,1,0,0)<=(1,0,2,0) Unsafe state (not Available)
  • 11. Continue………  For p2: (0,1,1,2)<=(1,0,2,0) Unsafe(Not Available)  For p3: (3,,1,0,0)<=(1,0,2,0) Unsafe(Not Available) For p4: (0,,0,1,0)<=(1,0,2,0) (Available) Safe Now the process p4 complete, it will turn over currently allocated resources ,incrementing the available free resources..
  • 12.  Updated value of Available Resource=Current value of available Resources + Allocated resources of Allocated matrix Need process(p1)=(1,1,0,0)<=(2,1,2,1) Available Now p1 is complete, it will turn over currently allocated resources ,incrementing the available free resources.. (1.1,0,1) Allocation of process(p4) (2,1,2,1) updated value of Available
  • 13. (2,1,2,1) Current value of Available (2,0,1,1) Allocation process (P1) (4,1,3,2) Updated value of Available