SlideShare a Scribd company logo
1 of 1
Download to read offline
What is Deadlock?
Deadlock occurs when each thread in a group of threads is waiting for a condition that can
only be caused by another member of the the group. For example, given threads T1 and
T2, it is possible that T1 is holding a resource X while waiting for resource Y to become
available. Meanwhile, T2 is holding resource Y and is waiting for resource X to become
available. This condition is known, in the computing literature, as deadlock.


How to Know When Deadlock Has Hit You?
Aside from having to debug a distributed program, deadlock is perhaps one of the most
difficult programming errors to correct. At times, deadlock appears to behave almost like an
infinite loop. Sometimes, the program will appear to run normally by not “locking up.” Often,
the program will need to be run multiple times to even notice the problem. The tragedy of
it all is that the results are usually not reproducible nor consistent.


There are four ways in which deadlock can occur. To eliminate deadlock, all you need to do
is find a way to eliminate one of the conditions that can cause it. It is not always desirable to
eliminate a given condition. We will return to a discussion of this point shortly; however, we
consider here the possibility of eliminating a circular wait condition.


Four Conditions of Deadlock


Mutual exclusion: It must not be possible for more than one thread to use a resource at
the same time.
Hold and wait: Threads must hold resources and wait for others to become available.
Deadlock is not possible if no thread ever holds more than one resource at a time. Nor
is it possible if a thread can acquire more than one resource, but acquires all its
resources at one instant.
No preemption: It must not be possible to remove a resource from a thread that holds
it. Only the thread that holds a resource can give it up.
Circular wait: There must be a cycle of threads, each holding at least one resource and
waiting to acquire one of the resources that the next thread in the cycle holds.

More Related Content

Similar to Dead

Deadlockpresentation.pptx
Deadlockpresentation.pptxDeadlockpresentation.pptx
Deadlockpresentation.pptxKARMVIR6
 
Java reentrant lock tutorial by jeetendra mandal
Java reentrant lock tutorial by jeetendra mandalJava reentrant lock tutorial by jeetendra mandal
Java reentrant lock tutorial by jeetendra mandaljeetendra mandal
 
Deadlock detection & prevention
Deadlock detection & preventionDeadlock detection & prevention
Deadlock detection & preventionIkhtiarUddinShaHin
 
Dead Lock in operating system
Dead Lock in operating systemDead Lock in operating system
Dead Lock in operating systemAli Haider
 
1. Research Topic Research the problem of livelock in a networked e.pdf
1. Research Topic Research the problem of livelock in a networked e.pdf1. Research Topic Research the problem of livelock in a networked e.pdf
1. Research Topic Research the problem of livelock in a networked e.pdfaromalcom
 
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.pptxsvulasal
 
Os case study word
Os case study wordOs case study word
Os case study wordDhol Yash
 
FP 202 Chapter 2 - Part 3
FP 202 Chapter 2 - Part 3FP 202 Chapter 2 - Part 3
FP 202 Chapter 2 - Part 3rohassanie
 
Another Tale of Two Patterns
Another Tale of Two PatternsAnother Tale of Two Patterns
Another Tale of Two PatternsKevlin Henney
 
Multi threading
Multi threadingMulti threading
Multi threadinggndu
 

Similar to Dead (20)

What is a deadlock
What is a deadlockWhat is a deadlock
What is a deadlock
 
Deadlockpresentation.pptx
Deadlockpresentation.pptxDeadlockpresentation.pptx
Deadlockpresentation.pptx
 
Deadlocks
DeadlocksDeadlocks
Deadlocks
 
Java reentrant lock tutorial by jeetendra mandal
Java reentrant lock tutorial by jeetendra mandalJava reentrant lock tutorial by jeetendra mandal
Java reentrant lock tutorial by jeetendra mandal
 
Deadlocks
DeadlocksDeadlocks
Deadlocks
 
Deadlock detection & prevention
Deadlock detection & preventionDeadlock detection & prevention
Deadlock detection & prevention
 
Deadlock Presentation
Deadlock PresentationDeadlock Presentation
Deadlock Presentation
 
Ch 4 deadlock
Ch 4 deadlockCh 4 deadlock
Ch 4 deadlock
 
Dead Lock in operating system
Dead Lock in operating systemDead Lock in operating system
Dead Lock in operating system
 
1. Research Topic Research the problem of livelock in a networked e.pdf
1. Research Topic Research the problem of livelock in a networked e.pdf1. Research Topic Research the problem of livelock in a networked e.pdf
1. Research Topic Research the problem of livelock in a networked e.pdf
 
Java threading
Java threadingJava threading
Java threading
 
Deadlock
DeadlockDeadlock
Deadlock
 
Deadlocks final
Deadlocks finalDeadlocks final
Deadlocks final
 
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
 
Os case study word
Os case study wordOs case study word
Os case study word
 
FP 202 Chapter 2 - Part 3
FP 202 Chapter 2 - Part 3FP 202 Chapter 2 - Part 3
FP 202 Chapter 2 - Part 3
 
Another Tale of Two Patterns
Another Tale of Two PatternsAnother Tale of Two Patterns
Another Tale of Two Patterns
 
Deadlock
DeadlockDeadlock
Deadlock
 
Multi threading
Multi threadingMulti threading
Multi threading
 
Concurrency in Java
Concurrency in JavaConcurrency in Java
Concurrency in Java
 

More from dgzz

Patrones
PatronesPatrones
Patronesdgzz
 
Ogro
OgroOgro
Ogrodgzz
 
Sq lactividades
Sq lactividadesSq lactividades
Sq lactividadesdgzz
 
Sq lactividades
Sq lactividadesSq lactividades
Sq lactividadesdgzz
 
2nd part
2nd part2nd part
2nd partdgzz
 
Vmfs
VmfsVmfs
Vmfsdgzz
 
Blog
BlogBlog
Blogdgzz
 
Blog
BlogBlog
Blogdgzz
 
Act1
Act1Act1
Act1dgzz
 
Act1
Act1Act1
Act1dgzz
 

More from dgzz (10)

Patrones
PatronesPatrones
Patrones
 
Ogro
OgroOgro
Ogro
 
Sq lactividades
Sq lactividadesSq lactividades
Sq lactividades
 
Sq lactividades
Sq lactividadesSq lactividades
Sq lactividades
 
2nd part
2nd part2nd part
2nd part
 
Vmfs
VmfsVmfs
Vmfs
 
Blog
BlogBlog
Blog
 
Blog
BlogBlog
Blog
 
Act1
Act1Act1
Act1
 
Act1
Act1Act1
Act1
 

Recently uploaded

WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 

Recently uploaded (20)

WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 

Dead

  • 1. What is Deadlock? Deadlock occurs when each thread in a group of threads is waiting for a condition that can only be caused by another member of the the group. For example, given threads T1 and T2, it is possible that T1 is holding a resource X while waiting for resource Y to become available. Meanwhile, T2 is holding resource Y and is waiting for resource X to become available. This condition is known, in the computing literature, as deadlock. How to Know When Deadlock Has Hit You? Aside from having to debug a distributed program, deadlock is perhaps one of the most difficult programming errors to correct. At times, deadlock appears to behave almost like an infinite loop. Sometimes, the program will appear to run normally by not “locking up.” Often, the program will need to be run multiple times to even notice the problem. The tragedy of it all is that the results are usually not reproducible nor consistent. There are four ways in which deadlock can occur. To eliminate deadlock, all you need to do is find a way to eliminate one of the conditions that can cause it. It is not always desirable to eliminate a given condition. We will return to a discussion of this point shortly; however, we consider here the possibility of eliminating a circular wait condition. Four Conditions of Deadlock Mutual exclusion: It must not be possible for more than one thread to use a resource at the same time. Hold and wait: Threads must hold resources and wait for others to become available. Deadlock is not possible if no thread ever holds more than one resource at a time. Nor is it possible if a thread can acquire more than one resource, but acquires all its resources at one instant. No preemption: It must not be possible to remove a resource from a thread that holds it. Only the thread that holds a resource can give it up. Circular wait: There must be a cycle of threads, each holding at least one resource and waiting to acquire one of the resources that the next thread in the cycle holds.