SlideShare a Scribd company logo
1 of 17
WELCOME
1
1. NOOR MOHAMMAD AKASH 152-15-5685
2. MD.FARDIN HASSAN 152-15-5532
3. KAWSAR AHMED 152-15-5610
4. ABU RAYHAN 152-15-6013
PRESENTATION
TOPIC
2
DEADLOCK
3
A process request the resources, the resources are not
available at that time, so the process enter into the
waiting state. The requesting resources are held by
another waiting process, both are in waiting state, this
situation is said to be. 4
What is Deadlock ?
Conditions for
deadlock
A deadlocked system must satisfied the following 4 conditions.
These are :
• 1. Mutual exclusion
• 2. Hold and wait
• 3. No preemption
• 4. Circular wait
Deadlock preventions
Difference from avoidance is that here, the System
itself is build in such a way that There are no
deadlocks. Make sure at least one of the 4 deadlock
conditions is never satisfied. This may however be
even more conservative than deadlock avoidance
strategy.
6
7
MUTUAL EXCLUSION:
We can deny this
condition
by simple protocol i.e.,
“convert the all non-
sharable
resources to sharable
resources”.
HOLD AND WAIT :
We can deny this condition
with following two protocols :
“A process request the
resources only when the
process has none”. • “Each
process to request and be
allocated all its resources
before it begins execution
NO PREEMPTION :
To ensure that this
condition does not hold,
we use the following
protocol : we preempt
the desired resources
from the
waiting process and
allocate
them to the requesting
CIRCULAR WAIT : We
ensure
that circular wait must
not
happened if we apply a
simple
solution, i.e., numbering
all the
resources types and each
process request
resources in an
increasing order of
enumeration
Deadlock detection
Detection mechanism of deadlocks for single instance of resource type is
different. We can detect the dead locks using wait for graph for single
instance resource type and detect using detection algorithm for multiple
instances of resource type.
1.Single instance of resource type :
Single instance of resource type means, the system
Consisting of only one resource for one type. We can
Detect this type of deadlocks with the help of wait
8
9
Wait for graph
A system is in deadlock state , if and only if the wait for
graph Contains cycles. So we can detect the deadlocks with
cycles. In the
Figure there is 2 cycles one is P1 to P2 to P1, second one
P2 to P3 to P2
So the system consisting of deadlocks.
P1 P2 P3
P1 P2R1 P2 P3R2
P1R3P2 P2R4P3
2. Several instance of resource type
The wait for graph is not applicable to several Instance of resource
type. So we need another Method for this type, that is “deadlock
detection Algorithm”. This algorithm looks like „banker‟s Algorithm”
and it employees several data Structures that are similar to those
used in the Banker‟s algorithm
10
Deadlock recovery
Once deadlock has been detected, some strategy Is
needed for recovery. The various approaches Of
recovering from deadlock are:
Process termination
Resource preemption
11
PROCESS TERMINATION
Process termination” it is one method to recover from
deadlock. We uses 2 methods for process termination,
these are:
A)abort ALL DEADLOCKED PROCESS :
It means release all the processes in the deadlocked state,
and start the allocation from the starting point. It is a
great expensive method. 12
PROCESS TERMINATION
B) About one by one process until the deadlock cycle is
eliminated :
in this Method first abort the one of the processes in the
deadlocked state, and allocated the resources to some
other process in the deadlock state then check whether
the deadlock braked
13
RESOURCE PREEMPTION
To eliminate deadlocks using resource preemption, preempt some
resources
From processes and give these resources to other processes until
the deadlock cycle is broken.
There are 3 methods to eliminate the deadlocks using resource
preemption. These are :
14
RESOURCE PREEMPTION
A) SELECTING A VICTIM : select a victim resource from the
deadlock state, and preempt that one.
B)Rollback : if a resource from a process is preempted, what
should be done with that process. The process must be roll
backed to some safe stateand restart it from that state.
C) Starvation : it must be guaranteed
15
16
17

More Related Content

What's hot

Operating System Deadlock Galvin
Operating System  Deadlock GalvinOperating System  Deadlock Galvin
Operating System Deadlock GalvinSonali Chauhan
 
Kernel mode vs user mode in linux
Kernel mode vs user mode in linuxKernel mode vs user mode in linux
Kernel mode vs user mode in linuxSiddique Ibrahim
 
DeadLock in Operating-Systems
DeadLock in Operating-SystemsDeadLock in Operating-Systems
DeadLock in Operating-SystemsVenkata Sreeram
 
Critical section problem in operating system.
Critical section problem in operating system.Critical section problem in operating system.
Critical section problem in operating system.MOHIT DADU
 
OS - Process Concepts
OS - Process ConceptsOS - Process Concepts
OS - Process ConceptsMukesh Chinta
 
Cs8792 cns - unit i
Cs8792   cns - unit iCs8792   cns - unit i
Cs8792 cns - unit iArthyR3
 
6 multiprogramming & time sharing
6 multiprogramming & time sharing6 multiprogramming & time sharing
6 multiprogramming & time sharingmyrajendra
 
Deadlock avoidance and prevention .. computer networking
Deadlock avoidance and prevention .. computer networkingDeadlock avoidance and prevention .. computer networking
Deadlock avoidance and prevention .. computer networkingTamannaSharma70
 
DEADLOCK PREVENTION AND AVOIDANCE.pptx
DEADLOCK PREVENTION AND AVOIDANCE.pptxDEADLOCK PREVENTION AND AVOIDANCE.pptx
DEADLOCK PREVENTION AND AVOIDANCE.pptxPugalenthiSomasundar
 
Deadlock in operating systems
Deadlock in operating systemsDeadlock in operating systems
Deadlock in operating systemsjamunaashok
 
Context Switching
Context SwitchingContext Switching
Context Switchingfranksvalli
 
Deadlock- Operating System
Deadlock- Operating SystemDeadlock- Operating System
Deadlock- Operating SystemRajan Shah
 
Semophores and it's types
Semophores and it's typesSemophores and it's types
Semophores and it's typesNishant Joshi
 
deadlock detection using Goldman's algorithm by ANIKET CHOUDHURY
deadlock detection using Goldman's algorithm by ANIKET CHOUDHURYdeadlock detection using Goldman's algorithm by ANIKET CHOUDHURY
deadlock detection using Goldman's algorithm by ANIKET CHOUDHURYअनिकेत चौधरी
 

What's hot (20)

Operating System Deadlock Galvin
Operating System  Deadlock GalvinOperating System  Deadlock Galvin
Operating System Deadlock Galvin
 
Processes and threads
Processes and threadsProcesses and threads
Processes and threads
 
SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSSCHEDULING ALGORITHMS
SCHEDULING ALGORITHMS
 
Deadlock
DeadlockDeadlock
Deadlock
 
Kernel mode vs user mode in linux
Kernel mode vs user mode in linuxKernel mode vs user mode in linux
Kernel mode vs user mode in linux
 
DeadLock in Operating-Systems
DeadLock in Operating-SystemsDeadLock in Operating-Systems
DeadLock in Operating-Systems
 
Priority scheduling algorithms
Priority scheduling algorithmsPriority scheduling algorithms
Priority scheduling algorithms
 
Critical section problem in operating system.
Critical section problem in operating system.Critical section problem in operating system.
Critical section problem in operating system.
 
OS - Process Concepts
OS - Process ConceptsOS - Process Concepts
OS - Process Concepts
 
Cs8792 cns - unit i
Cs8792   cns - unit iCs8792   cns - unit i
Cs8792 cns - unit i
 
6 multiprogramming & time sharing
6 multiprogramming & time sharing6 multiprogramming & time sharing
6 multiprogramming & time sharing
 
Process state in OS
Process state in OSProcess state in OS
Process state in OS
 
Deadlock avoidance and prevention .. computer networking
Deadlock avoidance and prevention .. computer networkingDeadlock avoidance and prevention .. computer networking
Deadlock avoidance and prevention .. computer networking
 
DEADLOCK PREVENTION AND AVOIDANCE.pptx
DEADLOCK PREVENTION AND AVOIDANCE.pptxDEADLOCK PREVENTION AND AVOIDANCE.pptx
DEADLOCK PREVENTION AND AVOIDANCE.pptx
 
Deadlock Prevention
Deadlock PreventionDeadlock Prevention
Deadlock Prevention
 
Deadlock in operating systems
Deadlock in operating systemsDeadlock in operating systems
Deadlock in operating systems
 
Context Switching
Context SwitchingContext Switching
Context Switching
 
Deadlock- Operating System
Deadlock- Operating SystemDeadlock- Operating System
Deadlock- Operating System
 
Semophores and it's types
Semophores and it's typesSemophores and it's types
Semophores and it's types
 
deadlock detection using Goldman's algorithm by ANIKET CHOUDHURY
deadlock detection using Goldman's algorithm by ANIKET CHOUDHURYdeadlock detection using Goldman's algorithm by ANIKET CHOUDHURY
deadlock detection using Goldman's algorithm by ANIKET CHOUDHURY
 

Similar to Deadlock (20)

osvishal-160830131208 (1).pdf
osvishal-160830131208 (1).pdfosvishal-160830131208 (1).pdf
osvishal-160830131208 (1).pdf
 
Deadlock
DeadlockDeadlock
Deadlock
 
Deadlocks by wani zahoor
Deadlocks by wani zahoorDeadlocks by wani zahoor
Deadlocks by wani zahoor
 
Unit 3 part 2(DEADLOCK)
Unit 3 part 2(DEADLOCK)Unit 3 part 2(DEADLOCK)
Unit 3 part 2(DEADLOCK)
 
Deadlock detection & prevention
Deadlock detection & preventionDeadlock detection & prevention
Deadlock detection & prevention
 
Deadlock Slides
Deadlock SlidesDeadlock Slides
Deadlock Slides
 
Deadlock
DeadlockDeadlock
Deadlock
 
Ch 4 deadlock
Ch 4 deadlockCh 4 deadlock
Ch 4 deadlock
 
Deadlocks
DeadlocksDeadlocks
Deadlocks
 
Os case study word
Os case study wordOs case study word
Os case study word
 
OS Presentation 1 (1).pptx
OS Presentation 1 (1).pptxOS Presentation 1 (1).pptx
OS Presentation 1 (1).pptx
 
Deadlocks final
Deadlocks finalDeadlocks final
Deadlocks final
 
Deadlocks prefinal
Deadlocks prefinalDeadlocks prefinal
Deadlocks prefinal
 
Deadlocksprefinal 161014115456
Deadlocksprefinal 161014115456Deadlocksprefinal 161014115456
Deadlocksprefinal 161014115456
 
Unit iv: Deadlocks
Unit iv: DeadlocksUnit iv: Deadlocks
Unit iv: Deadlocks
 
Rdbms
RdbmsRdbms
Rdbms
 
osvzjsjjdndnnssnnsnsndndndnndeadlock.pptx
osvzjsjjdndnnssnnsnsndndndnndeadlock.pptxosvzjsjjdndnnssnnsnsndndndnndeadlock.pptx
osvzjsjjdndnnssnnsnsndndndnndeadlock.pptx
 
Deadlocks 160928121516-160928183232
Deadlocks 160928121516-160928183232Deadlocks 160928121516-160928183232
Deadlocks 160928121516-160928183232
 
Operating system Deadlock
Operating system DeadlockOperating system Deadlock
Operating system Deadlock
 
operating system
operating systemoperating system
operating system
 

More from Daffodil international University (6)

Second Generation Computer
Second Generation ComputerSecond Generation Computer
Second Generation Computer
 
CPU Non-Preemptive Scheduling
CPU Non-Preemptive Scheduling CPU Non-Preemptive Scheduling
CPU Non-Preemptive Scheduling
 
real life application in numerical method
real life application in numerical methodreal life application in numerical method
real life application in numerical method
 
Transmission impairement (1)
Transmission impairement (1)Transmission impairement (1)
Transmission impairement (1)
 
Blast Algorithm
Blast AlgorithmBlast Algorithm
Blast Algorithm
 
Real life in mathematics
Real life in mathematicsReal life in mathematics
Real life in mathematics
 

Recently uploaded

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
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
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
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
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
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 
microprocessor 8085 and its interfacing
microprocessor 8085  and its interfacingmicroprocessor 8085  and its interfacing
microprocessor 8085 and its interfacingjaychoudhary37
 

Recently uploaded (20)

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...
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
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🔝
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
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
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
microprocessor 8085 and its interfacing
microprocessor 8085  and its interfacingmicroprocessor 8085  and its interfacing
microprocessor 8085 and its interfacing
 

Deadlock

  • 1. WELCOME 1 1. NOOR MOHAMMAD AKASH 152-15-5685 2. MD.FARDIN HASSAN 152-15-5532 3. KAWSAR AHMED 152-15-5610 4. ABU RAYHAN 152-15-6013
  • 4. A process request the resources, the resources are not available at that time, so the process enter into the waiting state. The requesting resources are held by another waiting process, both are in waiting state, this situation is said to be. 4 What is Deadlock ?
  • 5. Conditions for deadlock A deadlocked system must satisfied the following 4 conditions. These are : • 1. Mutual exclusion • 2. Hold and wait • 3. No preemption • 4. Circular wait
  • 6. Deadlock preventions Difference from avoidance is that here, the System itself is build in such a way that There are no deadlocks. Make sure at least one of the 4 deadlock conditions is never satisfied. This may however be even more conservative than deadlock avoidance strategy. 6
  • 7. 7 MUTUAL EXCLUSION: We can deny this condition by simple protocol i.e., “convert the all non- sharable resources to sharable resources”. HOLD AND WAIT : We can deny this condition with following two protocols : “A process request the resources only when the process has none”. • “Each process to request and be allocated all its resources before it begins execution NO PREEMPTION : To ensure that this condition does not hold, we use the following protocol : we preempt the desired resources from the waiting process and allocate them to the requesting CIRCULAR WAIT : We ensure that circular wait must not happened if we apply a simple solution, i.e., numbering all the resources types and each process request resources in an increasing order of enumeration
  • 8. Deadlock detection Detection mechanism of deadlocks for single instance of resource type is different. We can detect the dead locks using wait for graph for single instance resource type and detect using detection algorithm for multiple instances of resource type. 1.Single instance of resource type : Single instance of resource type means, the system Consisting of only one resource for one type. We can Detect this type of deadlocks with the help of wait 8
  • 9. 9 Wait for graph A system is in deadlock state , if and only if the wait for graph Contains cycles. So we can detect the deadlocks with cycles. In the Figure there is 2 cycles one is P1 to P2 to P1, second one P2 to P3 to P2 So the system consisting of deadlocks. P1 P2 P3 P1 P2R1 P2 P3R2 P1R3P2 P2R4P3
  • 10. 2. Several instance of resource type The wait for graph is not applicable to several Instance of resource type. So we need another Method for this type, that is “deadlock detection Algorithm”. This algorithm looks like „banker‟s Algorithm” and it employees several data Structures that are similar to those used in the Banker‟s algorithm 10
  • 11. Deadlock recovery Once deadlock has been detected, some strategy Is needed for recovery. The various approaches Of recovering from deadlock are: Process termination Resource preemption 11
  • 12. PROCESS TERMINATION Process termination” it is one method to recover from deadlock. We uses 2 methods for process termination, these are: A)abort ALL DEADLOCKED PROCESS : It means release all the processes in the deadlocked state, and start the allocation from the starting point. It is a great expensive method. 12
  • 13. PROCESS TERMINATION B) About one by one process until the deadlock cycle is eliminated : in this Method first abort the one of the processes in the deadlocked state, and allocated the resources to some other process in the deadlock state then check whether the deadlock braked 13
  • 14. RESOURCE PREEMPTION To eliminate deadlocks using resource preemption, preempt some resources From processes and give these resources to other processes until the deadlock cycle is broken. There are 3 methods to eliminate the deadlocks using resource preemption. These are : 14
  • 15. RESOURCE PREEMPTION A) SELECTING A VICTIM : select a victim resource from the deadlock state, and preempt that one. B)Rollback : if a resource from a process is preempted, what should be done with that process. The process must be roll backed to some safe stateand restart it from that state. C) Starvation : it must be guaranteed 15
  • 16. 16
  • 17. 17