SlideShare a Scribd company logo
1 of 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

More Related Content

What's hot (20)

Deadlock
DeadlockDeadlock
Deadlock
 
Deadlock
DeadlockDeadlock
Deadlock
 
Dead Lock
Dead LockDead Lock
Dead Lock
 
Deadlock- Operating System
Deadlock- Operating SystemDeadlock- Operating System
Deadlock- Operating System
 
Deadlock in Operating Systems
Deadlock in Operating SystemsDeadlock in Operating Systems
Deadlock in Operating Systems
 
Deadlock Detection
Deadlock DetectionDeadlock Detection
Deadlock Detection
 
Deadlocks in operating system
Deadlocks in operating systemDeadlocks in operating system
Deadlocks in operating system
 
deadlock handling
deadlock handlingdeadlock handling
deadlock handling
 
Transaction Management - Deadlock Handling
Transaction Management - Deadlock HandlingTransaction Management - Deadlock Handling
Transaction Management - Deadlock Handling
 
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 Slides
Deadlock SlidesDeadlock Slides
Deadlock Slides
 
Deadlock avoidance (Safe State, Resource Allocation Graph Algorithm)
Deadlock avoidance (Safe State, Resource Allocation Graph Algorithm)Deadlock avoidance (Safe State, Resource Allocation Graph Algorithm)
Deadlock avoidance (Safe State, Resource Allocation Graph Algorithm)
 
deadlock
deadlockdeadlock
deadlock
 
Deadlock management
Deadlock managementDeadlock management
Deadlock management
 
DBMS (Deadlock, deadlock prevention, 2phase locking)
DBMS (Deadlock, deadlock prevention, 2phase locking)DBMS (Deadlock, deadlock prevention, 2phase locking)
DBMS (Deadlock, deadlock prevention, 2phase locking)
 
Locking base concurrency control
  Locking base concurrency control  Locking base concurrency control
Locking base concurrency control
 
Deadlock ppt
Deadlock ppt Deadlock ppt
Deadlock ppt
 
Processes and threads
Processes and threadsProcesses and threads
Processes and threads
 
Process of operating system
Process of operating systemProcess of operating system
Process of operating system
 
Methods for handling deadlocks
Methods for handling deadlocksMethods for handling deadlocks
Methods for handling deadlocks
 

Similar to Deadlocks

Similar to 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
 

Recently uploaded

Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringmulugeta48
 
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 Standamitlee9823
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
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 - VDineshKumar4165
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Christo Ananth
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 

Recently uploaded (20)

Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
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
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
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
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
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
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...
 
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...
 
(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
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 

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