SlideShare ist ein Scribd-Unternehmen logo
1 von 24
DEADLOCK
By sakshi
06-0143-2013
Index
 Introduction
 Conditions for deadlock
 Strategies
 Deadlock issues
 Deadlock detection
 Recovery from deadlock
 Deadlock prevention
 Deadlock avoidance
Introduction
 A deadlock occurs when two transactions
wait indefinitely for each other to unlock
data.
 Occur In a multi-process system.
 Either the transactions involved in
deadlock are rolled back and restarted.
Example
 For example, a deadlock occurs when two
transactions, T1 and T2, exist in the following
mode:
T1 = access data items X and Y
T2 = access data items Y and X
 If T1 has not unlocked data item Y, T2 cannot
begin; if T2 has not unlocked data item X,
 T1 cannot continue.
Conditions for deadlocks
1) Mutual exclusion
 The resources involved must be unshareable
 Each resource is either currently allocated to
exactly one process or it is available. (Two
processes cannot simultaneously control the same
resource ).
MUTUAL EXCLUSION
2. Hold and Wait Condition
 There must exist a process that is holding
at least one resource and is waiting to
acquire additional resources that are
currently being held by other processes.
HOLD AND WAIT
3. No Preemption Condition
 The processes must not have resources
taken away while that resource is being
used.
4. Circular Wait Condition
 In circular wait a chain of processes exists
in which each process waits for one or
more resources held by the next process in
the chain
Strategies to deal with deadlock
 In general, there are four strategies of
dealing with deadlock problem:-
 The Ostrich Approach
 .Deadlock Detection and Recovery
 .Deadlock Avoidance
 .Deadlock Prevention
1.The Ostrich Approach
 • Ignore the problem altogether
– Pretend there is no problem
Reasonable if
 • Deadlocks occur very rarely
 • Cost of prevention is high
UNIX and Windows takes this approach
2. Deadlock Detection and Recovery
 – The system lets deadlocks occur.
 – The system tries to detect when a
deadlock occurs
 – When a deadlock is detected, some action
is taken to try to recover from it
 – One technique for detecting deadlocks is to build a
resource graph
 • A circle represents a process
 • A square represents a resource
 • A directed arc from a resource to a process denotes
ownership of a resource
 • A directed arc from a process to a resource denotes a
request for a resource
. Recovery From Deadlock
 Successively kill processes until the
system is deadlock free.
 Back off a process to some check point and
restarting the process at the checkpoint
later.
3) Deadlock Avoidance
 Carefully analyze each resource request to see if it can be
safely granted.
 avoid deadlock by only granting resources if granting
them cannot result in a deadlock situation later.
 Need an algorithm that can always avoid deadlock by
making right choice all the time.
4) Deadlock Prevention
 – Try to eliminate one of the four conditions of
deadlock
 Relaxing mutual exclusion requires making all
relevant resources sharable. Some resources can
be made sharable
 But it is not always possible. For ex-only one user
can use a printer at a time and if more than one
user will try access it then deadlock may occur
• Hold and wait condition
 Only allocate all resources at once
 Only allocate resource when process has
none
 This results in poor resource utilitization
 3) No-Preemption
 A process holding certain resources is denied a
further request, that process must release its
original resources.
 4) Circular wait
 Impose ordering on resources
• Give all resources a ranking; must acquire highest
ranked first
E.G. Always acquire resources in numerical order
• Need not acquire them all at once!
1) Image setter
2) Scanner Numerically ordered
3) Plotter resources
4) Tape Drive
5) CD Rom Drive
THANK YOU

Weitere ähnliche Inhalte

Was ist angesagt?

Operating System Deadlock Galvin
Operating System  Deadlock GalvinOperating System  Deadlock Galvin
Operating System Deadlock Galvin
Sonali Chauhan
 
Chapter 6 - Process Synchronization
Chapter 6 - Process SynchronizationChapter 6 - Process Synchronization
Chapter 6 - Process Synchronization
Wayne Jones Jnr
 

Was ist angesagt? (20)

Deadlock Avoidance - OS
Deadlock Avoidance - OSDeadlock Avoidance - OS
Deadlock Avoidance - OS
 
Deadlock detection & prevention
Deadlock detection & preventionDeadlock detection & prevention
Deadlock detection & prevention
 
Operating System Deadlock Galvin
Operating System  Deadlock GalvinOperating System  Deadlock Galvin
Operating System Deadlock Galvin
 
Operating System: Deadlock
Operating System: DeadlockOperating System: Deadlock
Operating System: Deadlock
 
Deadlock in Operating System
Deadlock in Operating SystemDeadlock in Operating System
Deadlock in Operating System
 
Chapter 6 - Process Synchronization
Chapter 6 - Process SynchronizationChapter 6 - Process Synchronization
Chapter 6 - Process Synchronization
 
Deadlock Prevention
Deadlock PreventionDeadlock Prevention
Deadlock Prevention
 
Deadlock detection and recovery by saad symbian
Deadlock detection and recovery by saad symbianDeadlock detection and recovery by saad symbian
Deadlock detection and recovery by saad symbian
 
Deadlock ppt
Deadlock ppt Deadlock ppt
Deadlock ppt
 
Deadlock- Operating System
Deadlock- Operating SystemDeadlock- Operating System
Deadlock- Operating System
 
Deadlock
DeadlockDeadlock
Deadlock
 
Methods for handling deadlocks
Methods for handling deadlocksMethods for handling deadlocks
Methods for handling deadlocks
 
Concurrency Control Techniques
Concurrency Control TechniquesConcurrency Control Techniques
Concurrency Control Techniques
 
Demand paging
Demand pagingDemand paging
Demand paging
 
Os case study word
Os case study wordOs case study word
Os case study word
 
Concurrency control
Concurrency control Concurrency control
Concurrency control
 
deadlock handling
deadlock handlingdeadlock handling
deadlock handling
 
Deadlock Avoidance in Operating System
Deadlock Avoidance in Operating SystemDeadlock Avoidance in Operating System
Deadlock Avoidance in Operating System
 
Process synchronization
Process synchronizationProcess synchronization
Process synchronization
 
Resource management
Resource managementResource management
Resource management
 

Ähnlich wie Deadlocks

FP 202 Chapter 2 - Part 3
FP 202 Chapter 2 - Part 3FP 202 Chapter 2 - Part 3
FP 202 Chapter 2 - Part 3
rohassanie
 

Ähnlich wie Deadlocks (20)

Unit 3 part 2(DEADLOCK)
Unit 3 part 2(DEADLOCK)Unit 3 part 2(DEADLOCK)
Unit 3 part 2(DEADLOCK)
 
Deadlocks
DeadlocksDeadlocks
Deadlocks
 
chapter06-new.pptx
chapter06-new.pptxchapter06-new.pptx
chapter06-new.pptx
 
Ch 4 deadlock
Ch 4 deadlockCh 4 deadlock
Ch 4 deadlock
 
Deadlockpresentation.pptx
Deadlockpresentation.pptxDeadlockpresentation.pptx
Deadlockpresentation.pptx
 
Deadlocks2
Deadlocks2Deadlocks2
Deadlocks2
 
Os module 2 d
Os module 2 dOs module 2 d
Os module 2 d
 
ikh311-05
ikh311-05ikh311-05
ikh311-05
 
3.6 Deadlock-operating system unit 3.pptx
3.6 Deadlock-operating system unit 3.pptx3.6 Deadlock-operating system unit 3.pptx
3.6 Deadlock-operating system unit 3.pptx
 
Deadlock in operating systems
Deadlock in operating systemsDeadlock in operating systems
Deadlock in operating systems
 
4.3 Deadlock [Autosaved].pptx
4.3 Deadlock [Autosaved].pptx4.3 Deadlock [Autosaved].pptx
4.3 Deadlock [Autosaved].pptx
 
Deadlocks by wani zahoor
Deadlocks by wani zahoorDeadlocks by wani zahoor
Deadlocks by wani zahoor
 
FP 202 Chapter 2 - Part 3
FP 202 Chapter 2 - Part 3FP 202 Chapter 2 - Part 3
FP 202 Chapter 2 - Part 3
 
Chapter06.ppt
Chapter06.pptChapter06.ppt
Chapter06.ppt
 
DEADLOCK
DEADLOCKDEADLOCK
DEADLOCK
 
Unit iv: Deadlocks
Unit iv: DeadlocksUnit iv: Deadlocks
Unit iv: Deadlocks
 
06-Deadlocks.ppt
06-Deadlocks.ppt06-Deadlocks.ppt
06-Deadlocks.ppt
 
Operating system - Deadlock
Operating system - DeadlockOperating system - Deadlock
Operating system - Deadlock
 
7308346-Deadlock.pptx
7308346-Deadlock.pptx7308346-Deadlock.pptx
7308346-Deadlock.pptx
 
Deadlock
DeadlockDeadlock
Deadlock
 

Kürzlich hochgeladen

Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
Epec Engineered Technologies
 

Kürzlich hochgeladen (20)

Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 

Deadlocks

  • 2. Index  Introduction  Conditions for deadlock  Strategies  Deadlock issues  Deadlock detection  Recovery from deadlock  Deadlock prevention  Deadlock avoidance
  • 3. Introduction  A deadlock occurs when two transactions wait indefinitely for each other to unlock data.  Occur In a multi-process system.  Either the transactions involved in deadlock are rolled back and restarted.
  • 4. Example  For example, a deadlock occurs when two transactions, T1 and T2, exist in the following mode: T1 = access data items X and Y T2 = access data items Y and X  If T1 has not unlocked data item Y, T2 cannot begin; if T2 has not unlocked data item X,  T1 cannot continue.
  • 5.
  • 6. Conditions for deadlocks 1) Mutual exclusion  The resources involved must be unshareable  Each resource is either currently allocated to exactly one process or it is available. (Two processes cannot simultaneously control the same resource ).
  • 8. 2. Hold and Wait Condition  There must exist a process that is holding at least one resource and is waiting to acquire additional resources that are currently being held by other processes.
  • 10. 3. No Preemption Condition  The processes must not have resources taken away while that resource is being used.
  • 11. 4. Circular Wait Condition  In circular wait a chain of processes exists in which each process waits for one or more resources held by the next process in the chain
  • 12.
  • 13. Strategies to deal with deadlock  In general, there are four strategies of dealing with deadlock problem:-  The Ostrich Approach  .Deadlock Detection and Recovery  .Deadlock Avoidance  .Deadlock Prevention
  • 14. 1.The Ostrich Approach  • Ignore the problem altogether – Pretend there is no problem Reasonable if  • Deadlocks occur very rarely  • Cost of prevention is high UNIX and Windows takes this approach
  • 15. 2. Deadlock Detection and Recovery  – The system lets deadlocks occur.  – The system tries to detect when a deadlock occurs  – When a deadlock is detected, some action is taken to try to recover from it
  • 16.  – One technique for detecting deadlocks is to build a resource graph  • A circle represents a process  • A square represents a resource  • A directed arc from a resource to a process denotes ownership of a resource  • A directed arc from a process to a resource denotes a request for a resource
  • 17.
  • 18. . Recovery From Deadlock  Successively kill processes until the system is deadlock free.  Back off a process to some check point and restarting the process at the checkpoint later.
  • 19. 3) Deadlock Avoidance  Carefully analyze each resource request to see if it can be safely granted.  avoid deadlock by only granting resources if granting them cannot result in a deadlock situation later.  Need an algorithm that can always avoid deadlock by making right choice all the time.
  • 20. 4) Deadlock Prevention  – Try to eliminate one of the four conditions of deadlock  Relaxing mutual exclusion requires making all relevant resources sharable. Some resources can be made sharable  But it is not always possible. For ex-only one user can use a printer at a time and if more than one user will try access it then deadlock may occur
  • 21. • Hold and wait condition  Only allocate all resources at once  Only allocate resource when process has none  This results in poor resource utilitization
  • 22.  3) No-Preemption  A process holding certain resources is denied a further request, that process must release its original resources.
  • 23.  4) Circular wait  Impose ordering on resources • Give all resources a ranking; must acquire highest ranked first E.G. Always acquire resources in numerical order • Need not acquire them all at once! 1) Image setter 2) Scanner Numerically ordered 3) Plotter resources 4) Tape Drive 5) CD Rom Drive