SlideShare a Scribd company logo
1 of 15
INTRODUCTION TO OPERATING
SYSTEMS
TOPIC
WHAT IS DEADLOCK?
The set of processes are said to be in
deadlock state, if each
process in a set is holding some
resource and is waiting for the
resource that is held by another
process in a set.
EXAMPLES OF DEADLOCKS
A real-world example would be traffic,
which is going only in one direction. Here,
a bridge is considered a resource.
So, when Deadlock happens, it can be
easily resolved if one car backs up
(Preempt resources and rollback).
Several cars may have to be backed up if a
deadlock situation occurs
One more example
John and Amy are brother-sister. They both are in a deadlock state as Amy
wants a laptop which John is having and is not in the mood to give it to his
sister. And Amy has a TV remote which John wants, But Amy is not giving it to
him.
SYSTEM MODEL
• The Deadlock System model is a way to describe
and analyze systems that may be prone to
deadlocks, which occur when two or more
processes are unable to proceed because they are
each waiting for the other to release a resource.
• A system consists of a finite number of resources
to be distributed among a number of competing
processes
• A process must request a resource before using it
and must release the resource after using it. A
• Each process utilizes a resource as follows :
 Request :- The process requests the resource. If the request
cannot be granted immediately (for example, if the resource is
being used by another process), then the requesting process
must wait until it can acquire the resource.
 Use :- The process can operate on the resource (for example,
if the resource is a printer, the process can print on the
printer).
 Release :- The process releases the resource.
• System consists of resources
• Resource types R1 , R2,....., RM
• Each resource type R1 has W1
instances.
DEADLOCK CHARACTERIZATION
A deadlock situation can arise if the following four
conditions hold simultaneously in a system
• Mutual exclusion : At least one resource must be held
in a non-sharable mode; that is, only one process at
a time can use the resource. If another process
requests that resource, the requesting process must
be delayed until the resource has been released.
• Hold and wait : A process must be holding at least
one resource and waiting to acquire additional
resources that are currently being held by other
processes.
• No preemption : Resources cannot be preempted;
that is, a resource can be released only voluntarily by
the process holding it, after that process has
completed its task.
• Circular wait : In the below figure there is P1 waiting for
P2 to release R2 , P2 is waiting for P3 to release R3 and
P3 is waiting for P1 to release R1 , this is known as
circular wait.
RESOURCE ALLOCATION GRAPH
• Deadlocks can be described more precisely in terms of a
directed graph called a system resource allocation graph. This
graph consists of a set of vertices V and a set of edges E.
• V is partitioned into two types:
• P = {P1 , P2 , …, P n }, the set consisting of all the
processes in the system
• R = {R1 , R2 , …, R m }, the set consisting of all resource
types in the system
• request edge – directed edge Pi → Rj
• assignment edge – directed edge Rj → Pi
The resource-allocation graph shown in Figure depicts
the following situation.
The sets P, R, and E:
• P = {P1, P2, P3}
• R = {R1, R2, R3, R4}
• E = {P1 → R1, P2 → R3, R1 → P2, R2 → P2, R2 → P1, R3
→P3}
Resource instances
• One instance of resource type R1
• Two instances of resource type R2
• One instance of resource type R3
• Three instances of resource type R4
Process states:
• Process P1 is holding an instance of resource type R2 and
is waiting for an instance of resource type R1.
• Process P2 is holding an instance of R1 and an instance of
R2 and is waiting for an instance of R3.
• Process P3 is holding an instance of R3.
After P3 requested an instance of
R2
12
Resource-allocation graph with a
deadlock.
Resource-allocation graph
with a cycle but no
deadlock
Relationship of cycles to deadlocks
• If a resource allocation graph contains no cycles ⇒ no deadlock
• If a resource allocation graph contains a cycle and if only one
instance exists per resource type ⇒ deadlock
• If a resource allocation graph contains a cycle and and if several
instances exists per resource type ⇒ possibility of deadlock
Summary
• The presentation covered deadlocks, a critical issue in
computer systems:
• Deadlocks are situations where processes are stuck due to
resource conflicts.
• Key concepts include the system model, deadlock
characterization, and resource-allocation graphs.
• Understanding and managing deadlocks is crucial for
system reliability and performance
Thank you!

More Related Content

Similar to OS deadlock.pptx

Similar to OS deadlock.pptx (20)

Chapter 4
Chapter 4Chapter 4
Chapter 4
 
Module 3 Deadlocks.pptx
Module 3 Deadlocks.pptxModule 3 Deadlocks.pptx
Module 3 Deadlocks.pptx
 
Deadlock (1).ppt
Deadlock (1).pptDeadlock (1).ppt
Deadlock (1).ppt
 
Deadlocks
DeadlocksDeadlocks
Deadlocks
 
OS Module-3 (2).pptx
OS Module-3 (2).pptxOS Module-3 (2).pptx
OS Module-3 (2).pptx
 
Os unit 4
Os unit 4Os unit 4
Os unit 4
 
Sucet os module_3_notes
Sucet os module_3_notesSucet os module_3_notes
Sucet os module_3_notes
 
Ch07 deadlocks
Ch07 deadlocksCh07 deadlocks
Ch07 deadlocks
 
Os5
Os5Os5
Os5
 
Deadlock
DeadlockDeadlock
Deadlock
 
14th November - Deadlock Prevention, Avoidance.ppt
14th November - Deadlock Prevention, Avoidance.ppt14th November - Deadlock Prevention, Avoidance.ppt
14th November - Deadlock Prevention, Avoidance.ppt
 
deadlock in OS.pptx
deadlock in OS.pptxdeadlock in OS.pptx
deadlock in OS.pptx
 
Ch7 deadlocks
Ch7   deadlocksCh7   deadlocks
Ch7 deadlocks
 
Gp1242 007 oer ppt
Gp1242 007 oer pptGp1242 007 oer ppt
Gp1242 007 oer ppt
 
Os module 2 d
Os module 2 dOs module 2 d
Os module 2 d
 
Deadlock.pptx
Deadlock.pptxDeadlock.pptx
Deadlock.pptx
 
Deadlock in Operating System
Deadlock in Operating SystemDeadlock in Operating System
Deadlock in Operating System
 
deadlock part5 unit 2.ppt
deadlock part5 unit 2.pptdeadlock part5 unit 2.ppt
deadlock part5 unit 2.ppt
 
Deadlocks
DeadlocksDeadlocks
Deadlocks
 
DeadlockMar21.ppt
DeadlockMar21.pptDeadlockMar21.ppt
DeadlockMar21.ppt
 

Recently uploaded

Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.Kamal Acharya
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiessarkmank1
 
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
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdfKamal Acharya
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxSCMS School of Architecture
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptxrouholahahmadi9876
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Arindam Chakraborty, Ph.D., P.E. (CA, TX)
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdfKamal Acharya
 
Digital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptxDigital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptxpritamlangde
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
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 PlayEpec Engineered Technologies
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesMayuraD1
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationBhangaleSonal
 
Learn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksLearn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksMagic Marks
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 

Recently uploaded (20)

Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
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
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
Digital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptxDigital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptx
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
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
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Learn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksLearn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic Marks
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 

OS deadlock.pptx

  • 2. WHAT IS DEADLOCK? The set of processes are said to be in deadlock state, if each process in a set is holding some resource and is waiting for the resource that is held by another process in a set.
  • 3. EXAMPLES OF DEADLOCKS A real-world example would be traffic, which is going only in one direction. Here, a bridge is considered a resource. So, when Deadlock happens, it can be easily resolved if one car backs up (Preempt resources and rollback). Several cars may have to be backed up if a deadlock situation occurs
  • 4. One more example John and Amy are brother-sister. They both are in a deadlock state as Amy wants a laptop which John is having and is not in the mood to give it to his sister. And Amy has a TV remote which John wants, But Amy is not giving it to him.
  • 5. SYSTEM MODEL • The Deadlock System model is a way to describe and analyze systems that may be prone to deadlocks, which occur when two or more processes are unable to proceed because they are each waiting for the other to release a resource. • A system consists of a finite number of resources to be distributed among a number of competing processes • A process must request a resource before using it and must release the resource after using it. A
  • 6. • Each process utilizes a resource as follows :  Request :- The process requests the resource. If the request cannot be granted immediately (for example, if the resource is being used by another process), then the requesting process must wait until it can acquire the resource.  Use :- The process can operate on the resource (for example, if the resource is a printer, the process can print on the printer).  Release :- The process releases the resource. • System consists of resources • Resource types R1 , R2,....., RM • Each resource type R1 has W1 instances.
  • 7. DEADLOCK CHARACTERIZATION A deadlock situation can arise if the following four conditions hold simultaneously in a system • Mutual exclusion : At least one resource must be held in a non-sharable mode; that is, only one process at a time can use the resource. If another process requests that resource, the requesting process must be delayed until the resource has been released.
  • 8. • Hold and wait : A process must be holding at least one resource and waiting to acquire additional resources that are currently being held by other processes. • No preemption : Resources cannot be preempted; that is, a resource can be released only voluntarily by the process holding it, after that process has completed its task.
  • 9. • Circular wait : In the below figure there is P1 waiting for P2 to release R2 , P2 is waiting for P3 to release R3 and P3 is waiting for P1 to release R1 , this is known as circular wait.
  • 10. RESOURCE ALLOCATION GRAPH • Deadlocks can be described more precisely in terms of a directed graph called a system resource allocation graph. This graph consists of a set of vertices V and a set of edges E. • V is partitioned into two types: • P = {P1 , P2 , …, P n }, the set consisting of all the processes in the system • R = {R1 , R2 , …, R m }, the set consisting of all resource types in the system • request edge – directed edge Pi → Rj • assignment edge – directed edge Rj → Pi
  • 11. The resource-allocation graph shown in Figure depicts the following situation. The sets P, R, and E: • P = {P1, P2, P3} • R = {R1, R2, R3, R4} • E = {P1 → R1, P2 → R3, R1 → P2, R2 → P2, R2 → P1, R3 →P3} Resource instances • One instance of resource type R1 • Two instances of resource type R2 • One instance of resource type R3 • Three instances of resource type R4 Process states: • Process P1 is holding an instance of resource type R2 and is waiting for an instance of resource type R1. • Process P2 is holding an instance of R1 and an instance of R2 and is waiting for an instance of R3. • Process P3 is holding an instance of R3.
  • 12. After P3 requested an instance of R2 12 Resource-allocation graph with a deadlock. Resource-allocation graph with a cycle but no deadlock
  • 13. Relationship of cycles to deadlocks • If a resource allocation graph contains no cycles ⇒ no deadlock • If a resource allocation graph contains a cycle and if only one instance exists per resource type ⇒ deadlock • If a resource allocation graph contains a cycle and and if several instances exists per resource type ⇒ possibility of deadlock
  • 14. Summary • The presentation covered deadlocks, a critical issue in computer systems: • Deadlocks are situations where processes are stuck due to resource conflicts. • Key concepts include the system model, deadlock characterization, and resource-allocation graphs. • Understanding and managing deadlocks is crucial for system reliability and performance