SlideShare a Scribd company logo
1 of 11
ORIENTAL INSTITUTE OF SCIENCE AND TECHNOLOGY,
BHOPAL
Department of Information Technology
SELF STUDY
Presentation
On
Deadlock
Presented By:-
DEEPAK YADAV
0105IT131027
Semester V09/03/15 1
Oriental Institute Of Science & Technology, Bhopal
The Deadlock Problem
 EXAMPLES:

"It takes money to make money".

You can't get a job without experience; you can't get
experience without a job.
BACKGROUND:
           The cause of deadlocks: Each process needing what another
process has. This results from sharing resources such as
memory devices, links.
Under  normal  operation,  a  resource  allocations  proceed  like 
this:

Request a resource (suspend until available if necessary.

Use the resource.

Release the resource.
09/03/15
2Oriental Institute Of Science & Technology,
Bhopal
     Deadlock Characterization
Deadlock can arise if four conditions hold simultaneously.

Mutual exclusion: only one process at a time can use a
resource

Hold and wait: a process holding at least one resource is
waiting to acquire additional resources held by other processes

No preemption: a resource can be released only voluntarily by
the process holding it, after that process has completed its task
 Circular wait: there exists a set {P0, P1, …, Pn} of waiting
processes such that P0 is waiting for a resource that is held by
P1, P1 is waiting for a resource that is held by P2, …, Pn–1 is
waiting for a resource that is held by Pn, and Pn is waiting for a
resource that is held by P0.09/03/15 3Oriental Institute Of Science & Technology,
Bhopal
Methods for Handling Deadlocks

Ensure that the system will never enter a
deadlock state – deadlock prevention

Allow the system to enter a deadlock state
and then recover

Ignore the problem and pretend that
deadlocks never occur in the system; used
by most operating systems, including UNIX
09/03/15 4Oriental Institute Of Science & Technology,
Bhopal
Do not allow one of the four conditions to occur.
Mutual exclusion:
a) Automatically holds for printers and other non-sharables.
b) Shared entities (read only files) don't need mutual exclusion
(and aren’t susceptible to deadlock.)
c) Prevention not possible, since some devices are intrinsically
non-sharable.
Hold and wait:
a) Collect all resources before execution.
b) A particular resource can only be requested when no others
are being held. A sequence of resources is always collected
beginning with the same one.
c) Utilization is low, starvation possible.
Deadlock Prevention
09/03/15 5Oriental Institute Of Science & Technology,
Bhopal
Example (Cont.)

The content of the matrix Need is defined to be Max –
Allocation
Need
A B C
P0 7 4 3
P1 1 2 2
P2 6 0 0
P3 0 1 1
P4 4 3 1
 The system is in a safe state since the sequence < P1,
P3, P4, P2, P0> satisfies safety criteria
09/03/15 6
Oriental Institute Of Science & Technology,
Bhopal
NOTE: All deadlocks are unsafe, but all unsafes are
NOT deadlocks.
SAFE
DEADLOCK
UNSAFE
Only with luck will
processes avoid
deadlock.
O.S. can avoid
deadlock.
Deadlock Avoidance
09/03/15 7Oriental Institute Of Science & Technology,
Bhopal

Single instance of a resource type

Use a resource-allocation graph

Multiple instances of a resource
type

Use the banker’s algorithm
Avoidance algorithms
09/03/15 8Oriental Institute Of Science & Technology,
Bhopal
Recovery from Deadlock:
Process Termination

Abort all deadlocked processes

Abort one process at a time until the deadlock cycle is
eliminated

In which order should we choose to abort?

Priority of the process

How long process has computed, and how much
longer to completion

Resources the process has used

Resources process needs to complete

How many processes will need to be terminated

Is process interactive or batch?
09/03/15 9Oriental Institute Of Science & Technology,
Bhopal
Recovery from Deadlock:
Resource Preemption

Selecting a victim – minimize cost

Rollback – return to some safe state,
restart process for that state

Problem: starvation – same process may
always be picked as victim, include number
of rollback in cost factor
09/03/15 10Oriental Institute Of Science & Technology,
Bhopal
09/03/15 11Oriental Institute Of Science & Technology,
Bhopal

More Related Content

Similar to Deadlock ppt

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)Shayek Parvez
 
Deadlock- Operating System
Deadlock- Operating SystemDeadlock- Operating System
Deadlock- Operating SystemRajan Shah
 
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
 
Lecture 6- Deadlocks.pptx
Lecture 6- Deadlocks.pptxLecture 6- Deadlocks.pptx
Lecture 6- Deadlocks.pptxAmanuelmergia
 
Lecture 6- Deadlocks (1) (1).pptx
Lecture 6- Deadlocks (1) (1).pptxLecture 6- Deadlocks (1) (1).pptx
Lecture 6- Deadlocks (1) (1).pptxAmanuelmergia
 
Os case study word
Os case study wordOs case study word
Os case study wordDhol Yash
 
Deadlock in Operating System
Deadlock in Operating SystemDeadlock in Operating System
Deadlock in Operating SystemSanthiNivas
 
Kcd226 Sistem Operasi Lecture05
Kcd226 Sistem Operasi Lecture05Kcd226 Sistem Operasi Lecture05
Kcd226 Sistem Operasi Lecture05Cahyo Darujati
 

Similar to Deadlock ppt (20)

DEADLOCK
DEADLOCKDEADLOCK
DEADLOCK
 
Overview of Deadlock unit 3 part 1
Overview of Deadlock unit 3 part 1Overview of Deadlock unit 3 part 1
Overview of Deadlock unit 3 part 1
 
Deadlock
DeadlockDeadlock
Deadlock
 
Os module 2 d
Os module 2 dOs module 2 d
Os module 2 d
 
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)
 
Ch 4 deadlock
Ch 4 deadlockCh 4 deadlock
Ch 4 deadlock
 
Deadlocks
DeadlocksDeadlocks
Deadlocks
 
Deadlock Slides
Deadlock SlidesDeadlock Slides
Deadlock Slides
 
Deadlock Presentation
Deadlock PresentationDeadlock Presentation
Deadlock Presentation
 
Deadlock- Operating System
Deadlock- Operating SystemDeadlock- Operating System
Deadlock- Operating System
 
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
 
Lecture 6- Deadlocks.pptx
Lecture 6- Deadlocks.pptxLecture 6- Deadlocks.pptx
Lecture 6- Deadlocks.pptx
 
Lecture 6- Deadlocks (1) (1).pptx
Lecture 6- Deadlocks (1) (1).pptxLecture 6- Deadlocks (1) (1).pptx
Lecture 6- Deadlocks (1) (1).pptx
 
Os case study word
Os case study wordOs case study word
Os case study word
 
Deadlocks
 Deadlocks Deadlocks
Deadlocks
 
Deadlock in Operating System
Deadlock in Operating SystemDeadlock in Operating System
Deadlock in Operating System
 
Chapter06
Chapter06Chapter06
Chapter06
 
Kcd226 Sistem Operasi Lecture05
Kcd226 Sistem Operasi Lecture05Kcd226 Sistem Operasi Lecture05
Kcd226 Sistem Operasi Lecture05
 
Section07-Deadlocks.pdf
Section07-Deadlocks.pdfSection07-Deadlocks.pdf
Section07-Deadlocks.pdf
 

Recently uploaded

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.pptxJuliansyahHarahap1
 
Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilVinayVitekari
 
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
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...HenryBriggs2
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaOmar Fathy
 
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
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityMorshed Ahmed Rahath
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...drmkjayanthikannan
 
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
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Ramkumar k
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdfKamal Acharya
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startQuintin Balsdon
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network DevicesChandrakantDivate1
 
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
 
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...vershagrag
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesMayuraD1
 
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
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxMuhammadAsimMuhammad6
 

Recently uploaded (20)

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
 
Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech Civil
 
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
 
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
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
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
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
 
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
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
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
 
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
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
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
 

Deadlock ppt

  • 1. ORIENTAL INSTITUTE OF SCIENCE AND TECHNOLOGY, BHOPAL Department of Information Technology SELF STUDY Presentation On Deadlock Presented By:- DEEPAK YADAV 0105IT131027 Semester V09/03/15 1 Oriental Institute Of Science & Technology, Bhopal
  • 2. The Deadlock Problem  EXAMPLES:  "It takes money to make money".  You can't get a job without experience; you can't get experience without a job. BACKGROUND:            The cause of deadlocks: Each process needing what another process has. This results from sharing resources such as memory devices, links. Under  normal  operation,  a  resource  allocations  proceed  like  this:  Request a resource (suspend until available if necessary.  Use the resource.  Release the resource. 09/03/15 2Oriental Institute Of Science & Technology, Bhopal
  • 3.      Deadlock Characterization Deadlock can arise if four conditions hold simultaneously.  Mutual exclusion: only one process at a time can use a resource  Hold and wait: a process holding at least one resource is waiting to acquire additional resources held by other processes  No preemption: a resource can be released only voluntarily by the process holding it, after that process has completed its task  Circular wait: there exists a set {P0, P1, …, Pn} of waiting processes such that P0 is waiting for a resource that is held by P1, P1 is waiting for a resource that is held by P2, …, Pn–1 is waiting for a resource that is held by Pn, and Pn is waiting for a resource that is held by P0.09/03/15 3Oriental Institute Of Science & Technology, Bhopal
  • 4. Methods for Handling Deadlocks  Ensure that the system will never enter a deadlock state – deadlock prevention  Allow the system to enter a deadlock state and then recover  Ignore the problem and pretend that deadlocks never occur in the system; used by most operating systems, including UNIX 09/03/15 4Oriental Institute Of Science & Technology, Bhopal
  • 5. Do not allow one of the four conditions to occur. Mutual exclusion: a) Automatically holds for printers and other non-sharables. b) Shared entities (read only files) don't need mutual exclusion (and aren’t susceptible to deadlock.) c) Prevention not possible, since some devices are intrinsically non-sharable. Hold and wait: a) Collect all resources before execution. b) A particular resource can only be requested when no others are being held. A sequence of resources is always collected beginning with the same one. c) Utilization is low, starvation possible. Deadlock Prevention 09/03/15 5Oriental Institute Of Science & Technology, Bhopal
  • 6. Example (Cont.)  The content of the matrix Need is defined to be Max – Allocation Need A B C P0 7 4 3 P1 1 2 2 P2 6 0 0 P3 0 1 1 P4 4 3 1  The system is in a safe state since the sequence < P1, P3, P4, P2, P0> satisfies safety criteria 09/03/15 6 Oriental Institute Of Science & Technology, Bhopal
  • 7. NOTE: All deadlocks are unsafe, but all unsafes are NOT deadlocks. SAFE DEADLOCK UNSAFE Only with luck will processes avoid deadlock. O.S. can avoid deadlock. Deadlock Avoidance 09/03/15 7Oriental Institute Of Science & Technology, Bhopal
  • 8.  Single instance of a resource type  Use a resource-allocation graph  Multiple instances of a resource type  Use the banker’s algorithm Avoidance algorithms 09/03/15 8Oriental Institute Of Science & Technology, Bhopal
  • 9. Recovery from Deadlock: Process Termination  Abort all deadlocked processes  Abort one process at a time until the deadlock cycle is eliminated  In which order should we choose to abort?  Priority of the process  How long process has computed, and how much longer to completion  Resources the process has used  Resources process needs to complete  How many processes will need to be terminated  Is process interactive or batch? 09/03/15 9Oriental Institute Of Science & Technology, Bhopal
  • 10. Recovery from Deadlock: Resource Preemption  Selecting a victim – minimize cost  Rollback – return to some safe state, restart process for that state  Problem: starvation – same process may always be picked as victim, include number of rollback in cost factor 09/03/15 10Oriental Institute Of Science & Technology, Bhopal
  • 11. 09/03/15 11Oriental Institute Of Science & Technology, Bhopal