SlideShare a Scribd company logo
1 of 14
“Deadlocks” in OS
Presented By : ZAHID ALI
Ciit/FA15-BCE-021/Atk
What are Deadlocks ?
• A set of blocked processes each holding a resource and
waiting to acquire a resource held by another process
in the set .
• In simple words, Deadlock occurs when a process
request the resources , the resources are not available at
that time so the process enter into waiting state . The
requesting resources are held by another waiting process
, both are in waiting state, this situation is called
Deadlock.
System Model
Request.
The process requests the resource.
Use.
The process can operate on the resource.
Release.
The process releases the resource.
Examples :
 System has two disk drives .
P1 and P2 each hold one disk drive and each
needs another one.
 Two trains approaches each other at crossing,
both will come to full stop each other and neither
shall start until other has gone.
Conditions for Deadlock :
Mutual Exclusion :
Processes claim the exclusive control of the resources they
require .
Hold and Wait :
Processes hold resources already allocated to them while
waiting for additional resources.
No preemption :
Resources cannot be removed from the process holding
them until the resources are used to completion.
Circular Wait :
A circular chain of processes exists such that each process
hold one or more resources that are being requested by
next process in the chain.
Traffic Example :
• Traffic only in one direction.
• Each section of the bridge can be viewed as a resource.
• Deadlock is occurred and it can be resolves if one car
backs up ( preempt resources and rollback).
Resource Allocation
Graphs
• 1) Resource Allocation with no deadlock
• 2) Resource Allocation with deadlocked.
Methods of Handling
Deadlocks
• We can use a protocol to prevent or avoid deadlocks,
ensuring that the system will never enter a deadlocked state.
• We can allow the system to enter a deadlocked state, detect
it, and recover.
• We can ignore the problem altogether and pretend that
deadlocks never occur in the system.
Deadlock Prevention
Prevention Eliminates one of the Four
Conditions
• Elimination of Mutual Exclusion
• Elimination of Hold&Wait condition
• Elimination of No preemption condition
• Elimination of Circular Wait Condition
Deadlock Avoidance
Dead lock avoidance technique is used
to avoid deadlock.
 Safe State: if deadlock not occur then it is safe state.
 Unsafe State: if deadlock occur then it is unsafe
state. The idea of avoiding deadlock is simply not allow
the system to enter an unsafe state.
Resource Allocation Graph
• Safe State:
• Unsafe State:
Banker’s Algorithm
Multiple instances
Each process must have a priority claim for
maximum use.
When a process requests a resource it may have
to wait.
When a process gets all its resources it must
return them in a finite amount of time.
Recovery from Deadlocks
• Process Termination
Abort all the process until the deadlock cycle is
eliminated.
• Resource Preemption
Preempt resources by selecting a victim and roll
it back by using starvation.
THANKS..!!
oAny Queries ?

More Related Content

What's hot

Cyber security training at ist apr-18
Cyber security training at ist apr-18Cyber security training at ist apr-18
Cyber security training at ist apr-18Sagar Walvekar
 
Dining Philosopher Problem
Dining Philosopher ProblemDining Philosopher Problem
Dining Philosopher ProblemRaval Vijay
 
Deadlock in Operating System
Deadlock in Operating SystemDeadlock in Operating System
Deadlock in Operating SystemAUST
 
Dead Lock In Operating Systems
Dead Lock In Operating SystemsDead Lock In Operating Systems
Dead Lock In Operating Systemstotallooser
 
FORWARD CHAINING AND BACKWARD CHAINING SYSTEMS IN ARTIFICIAL INTELIGENCE
FORWARD CHAINING AND BACKWARD CHAINING SYSTEMS IN ARTIFICIAL INTELIGENCEFORWARD CHAINING AND BACKWARD CHAINING SYSTEMS IN ARTIFICIAL INTELIGENCE
FORWARD CHAINING AND BACKWARD CHAINING SYSTEMS IN ARTIFICIAL INTELIGENCEJohnLeonard Onwuzuruigbo
 
Deadlock in Distributed Systems
Deadlock in Distributed SystemsDeadlock in Distributed Systems
Deadlock in Distributed SystemsPritom Saha Akash
 
Deadlock- Operating System
Deadlock- Operating SystemDeadlock- Operating System
Deadlock- Operating SystemRajan Shah
 
Superscalar Architecture_AIUB
Superscalar Architecture_AIUBSuperscalar Architecture_AIUB
Superscalar Architecture_AIUBNusrat Mary
 
Operating System Deadlock Galvin
Operating System  Deadlock GalvinOperating System  Deadlock Galvin
Operating System Deadlock GalvinSonali Chauhan
 
Distributed Mutual Exclusion and Distributed Deadlock Detection
Distributed Mutual Exclusion and Distributed Deadlock DetectionDistributed Mutual Exclusion and Distributed Deadlock Detection
Distributed Mutual Exclusion and Distributed Deadlock DetectionSHIKHA GAUTAM
 

What's hot (20)

Cyber security training at ist apr-18
Cyber security training at ist apr-18Cyber security training at ist apr-18
Cyber security training at ist apr-18
 
Dining Philosopher Problem
Dining Philosopher ProblemDining Philosopher Problem
Dining Philosopher Problem
 
Deadlock
DeadlockDeadlock
Deadlock
 
Operating System: Deadlock
Operating System: DeadlockOperating System: Deadlock
Operating System: Deadlock
 
Deadlock
DeadlockDeadlock
Deadlock
 
Deadlock ppt
Deadlock ppt Deadlock ppt
Deadlock ppt
 
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
 
Dead Lock In Operating Systems
Dead Lock In Operating SystemsDead Lock In Operating Systems
Dead Lock In Operating Systems
 
Deadlock
DeadlockDeadlock
Deadlock
 
FORWARD CHAINING AND BACKWARD CHAINING SYSTEMS IN ARTIFICIAL INTELIGENCE
FORWARD CHAINING AND BACKWARD CHAINING SYSTEMS IN ARTIFICIAL INTELIGENCEFORWARD CHAINING AND BACKWARD CHAINING SYSTEMS IN ARTIFICIAL INTELIGENCE
FORWARD CHAINING AND BACKWARD CHAINING SYSTEMS IN ARTIFICIAL INTELIGENCE
 
Deadlock in Distributed Systems
Deadlock in Distributed SystemsDeadlock in Distributed Systems
Deadlock in Distributed Systems
 
Deadlock- Operating System
Deadlock- Operating SystemDeadlock- Operating System
Deadlock- Operating System
 
Ddbms1
Ddbms1Ddbms1
Ddbms1
 
Deadlock Avoidance in Operating System
Deadlock Avoidance in Operating SystemDeadlock Avoidance in Operating System
Deadlock Avoidance in Operating System
 
Monitors
MonitorsMonitors
Monitors
 
7 Deadlocks
7 Deadlocks7 Deadlocks
7 Deadlocks
 
Superscalar Architecture_AIUB
Superscalar Architecture_AIUBSuperscalar Architecture_AIUB
Superscalar Architecture_AIUB
 
Operating System Deadlock Galvin
Operating System  Deadlock GalvinOperating System  Deadlock Galvin
Operating System Deadlock Galvin
 
Distributed Mutual Exclusion and Distributed Deadlock Detection
Distributed Mutual Exclusion and Distributed Deadlock DetectionDistributed Mutual Exclusion and Distributed Deadlock Detection
Distributed Mutual Exclusion and Distributed Deadlock Detection
 

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 by wani zahoor
Deadlocks by wani zahoorDeadlocks by wani zahoor
Deadlocks by wani zahoor
 
osvishal-160830131208 (1).pdf
osvishal-160830131208 (1).pdfosvishal-160830131208 (1).pdf
osvishal-160830131208 (1).pdf
 
Deadlock
DeadlockDeadlock
Deadlock
 
Deadlocks
DeadlocksDeadlocks
Deadlocks
 
4.3 Deadlock [Autosaved].pptx
4.3 Deadlock [Autosaved].pptx4.3 Deadlock [Autosaved].pptx
4.3 Deadlock [Autosaved].pptx
 
Ch 4 deadlock
Ch 4 deadlockCh 4 deadlock
Ch 4 deadlock
 
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
DeadlockDeadlock
Deadlock
 
Operating system Deadlock
Operating system DeadlockOperating system Deadlock
Operating system Deadlock
 
Unit iv: Deadlocks
Unit iv: DeadlocksUnit iv: Deadlocks
Unit iv: Deadlocks
 
Deadlockproj.pptx
Deadlockproj.pptxDeadlockproj.pptx
Deadlockproj.pptx
 
Deadlockpresentation.pptx
Deadlockpresentation.pptxDeadlockpresentation.pptx
Deadlockpresentation.pptx
 
Deadlock's
Deadlock'sDeadlock's
Deadlock's
 
OS 7.pptx
OS 7.pptxOS 7.pptx
OS 7.pptx
 
Deadlock in Operating Systems
Deadlock in Operating SystemsDeadlock in Operating Systems
Deadlock in Operating Systems
 
Rdbms
RdbmsRdbms
Rdbms
 
DEADLOCK
DEADLOCKDEADLOCK
DEADLOCK
 
osvzjsjjdndnnssnnsnsndndndnndeadlock.pptx
osvzjsjjdndnnssnnsnsndndndnndeadlock.pptxosvzjsjjdndnnssnnsnsndndndnndeadlock.pptx
osvzjsjjdndnnssnnsnsndndndnndeadlock.pptx
 
Deadlock and memory management -- Operating System
Deadlock and memory management -- Operating SystemDeadlock and memory management -- Operating System
Deadlock and memory management -- Operating System
 

More from Zahid Ali

Bit coin cryptocurrency
Bit coin cryptocurrencyBit coin cryptocurrency
Bit coin cryptocurrencyZahid Ali
 
Echelon and reduced echelon form & Filters
Echelon and reduced echelon form & FiltersEchelon and reduced echelon form & Filters
Echelon and reduced echelon form & FiltersZahid Ali
 
Importance of English Language
Importance of English LanguageImportance of English Language
Importance of English LanguageZahid Ali
 
Learning refines and elevates the mind
Learning refines and elevates the mindLearning refines and elevates the mind
Learning refines and elevates the mindZahid Ali
 
Role of media presentation
Role of media presentationRole of media presentation
Role of media presentationZahid Ali
 
History of kpk
History of kpkHistory of kpk
History of kpkZahid Ali
 
Inflation or rising prices
Inflation or rising pricesInflation or rising prices
Inflation or rising pricesZahid Ali
 
Purpose of life
Purpose of  lifePurpose of  life
Purpose of lifeZahid Ali
 
Black hawk down
Black hawk downBlack hawk down
Black hawk downZahid Ali
 
Learning refines and elevates the mind
Learning refines and elevates the mindLearning refines and elevates the mind
Learning refines and elevates the mindZahid Ali
 

More from Zahid Ali (14)

Bit coin cryptocurrency
Bit coin cryptocurrencyBit coin cryptocurrency
Bit coin cryptocurrency
 
Echelon and reduced echelon form & Filters
Echelon and reduced echelon form & FiltersEchelon and reduced echelon form & Filters
Echelon and reduced echelon form & Filters
 
Importance of English Language
Importance of English LanguageImportance of English Language
Importance of English Language
 
Learning refines and elevates the mind
Learning refines and elevates the mindLearning refines and elevates the mind
Learning refines and elevates the mind
 
Role of media presentation
Role of media presentationRole of media presentation
Role of media presentation
 
History of kpk
History of kpkHistory of kpk
History of kpk
 
Inflation or rising prices
Inflation or rising pricesInflation or rising prices
Inflation or rising prices
 
Purpose of life
Purpose of  lifePurpose of  life
Purpose of life
 
Begging
BeggingBegging
Begging
 
Hacking
HackingHacking
Hacking
 
Failure
FailureFailure
Failure
 
Democracy
DemocracyDemocracy
Democracy
 
Black hawk down
Black hawk downBlack hawk down
Black hawk down
 
Learning refines and elevates the mind
Learning refines and elevates the mindLearning refines and elevates the mind
Learning refines and elevates the mind
 

Recently uploaded

(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxhumanexperienceaaa
 

Recently uploaded (20)

★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
 

Deadlocks

  • 1. “Deadlocks” in OS Presented By : ZAHID ALI Ciit/FA15-BCE-021/Atk
  • 2. What are Deadlocks ? • A set of blocked processes each holding a resource and waiting to acquire a resource held by another process in the set . • In simple words, Deadlock occurs when a process request the resources , the resources are not available at that time so the process enter into waiting state . The requesting resources are held by another waiting process , both are in waiting state, this situation is called Deadlock.
  • 3. System Model Request. The process requests the resource. Use. The process can operate on the resource. Release. The process releases the resource.
  • 4. Examples :  System has two disk drives . P1 and P2 each hold one disk drive and each needs another one.  Two trains approaches each other at crossing, both will come to full stop each other and neither shall start until other has gone.
  • 5. Conditions for Deadlock : Mutual Exclusion : Processes claim the exclusive control of the resources they require . Hold and Wait : Processes hold resources already allocated to them while waiting for additional resources. No preemption : Resources cannot be removed from the process holding them until the resources are used to completion. Circular Wait : A circular chain of processes exists such that each process hold one or more resources that are being requested by next process in the chain.
  • 6. Traffic Example : • Traffic only in one direction. • Each section of the bridge can be viewed as a resource. • Deadlock is occurred and it can be resolves if one car backs up ( preempt resources and rollback).
  • 7. Resource Allocation Graphs • 1) Resource Allocation with no deadlock • 2) Resource Allocation with deadlocked.
  • 8. Methods of Handling Deadlocks • We can use a protocol to prevent or avoid deadlocks, ensuring that the system will never enter a deadlocked state. • We can allow the system to enter a deadlocked state, detect it, and recover. • We can ignore the problem altogether and pretend that deadlocks never occur in the system.
  • 9. Deadlock Prevention Prevention Eliminates one of the Four Conditions • Elimination of Mutual Exclusion • Elimination of Hold&Wait condition • Elimination of No preemption condition • Elimination of Circular Wait Condition
  • 10. Deadlock Avoidance Dead lock avoidance technique is used to avoid deadlock.  Safe State: if deadlock not occur then it is safe state.  Unsafe State: if deadlock occur then it is unsafe state. The idea of avoiding deadlock is simply not allow the system to enter an unsafe state.
  • 11. Resource Allocation Graph • Safe State: • Unsafe State:
  • 12. Banker’s Algorithm Multiple instances Each process must have a priority claim for maximum use. When a process requests a resource it may have to wait. When a process gets all its resources it must return them in a finite amount of time.
  • 13. Recovery from Deadlocks • Process Termination Abort all the process until the deadlock cycle is eliminated. • Resource Preemption Preempt resources by selecting a victim and roll it back by using starvation.