SlideShare une entreprise Scribd logo
1  sur  17
Télécharger pour lire hors ligne
Operating System
ALA PRESENTATION
TOPICS:
Deadlock:
•Definition
•Deadlock Properties and Characteristics
•Deadlock Prevention
•Deadlock algorithms
•Deadlock Detection and Recovery
DEADLOCK
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.
“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 AVOIDANCE
Avoid actions that may lead to a deadlock.
Think of it as a state machine moving from 1 state to another as each instruction is executed.
We can avoid the situation of deadlocked by:
1.Safe State
2.Banker’s Algorithm
3.Resource Allocation Graph
SAFE STATE
Safe state is one where It is not a deadlocked state There is some sequence by which all requests
can be satisfied.
To avoid deadlocks, we try to make only those transitions that will take you from one safe state to
another. We avoid transitions to unsafe state (a state that is not deadlocked, and is not safe).
Safe unsafe and deadlock state spaces
Unsafe
Safe
Deadlock
BANKER'S ALGORITHM
When a request is made, check to see if after the request is satisfied, there is a (at least one!)
sequence of moves that can satisfy all the requests ie. the new state is safe. If so, satisfy the
request, else make the request wait.
RESOURCE ALLOCATION GRAPH
If we have a resource allocation system with only one instance of each process, a variant of the
resource allocation graph can be used for deadlock avoidance.
DEADLOCK PREVENTION
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.
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
process.
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 for graph. A system is in deadlock state , if and only if the wait for graph contains cycles.
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.
DEADLOCK RECOVERY
Once deadlock has been detected, some strategy is needed for recovery. The various approaches
of recovering from deadlock are:
1. PROCESS TERMINATION
2. RESOURCE PREEMPTION
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.
b) ABORT 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 or not. If no,
abort the another process from the deadlock state. Continue this process until we recover
from deadlock. This method is also expensive but compare with first one it is better.
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 :
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 state and restart it from that state.
c) STARVATION : It must be guaranteed that resource will not always be preempted from the
same process to avoid starvation problem.
Thank You

Contenu connexe

Similaire à osvishal-160830131208 (1).pdf

Deadlocks prefinal
Deadlocks prefinalDeadlocks prefinal
Deadlocks prefinalmarangburu42
 
Deadlocksprefinal 161014115456
Deadlocksprefinal 161014115456Deadlocksprefinal 161014115456
Deadlocksprefinal 161014115456marangburu42
 
osvzjsjjdndnnssnnsnsndndndnndeadlock.pptx
osvzjsjjdndnnssnnsnsndndndnndeadlock.pptxosvzjsjjdndnnssnnsnsndndndnndeadlock.pptx
osvzjsjjdndnnssnnsnsndndndnndeadlock.pptxBhaskar271887
 
Deadlock in Distributed Systems
Deadlock in Distributed SystemsDeadlock in Distributed Systems
Deadlock in Distributed SystemsPritom Saha Akash
 
Deadlock and memory management -- Operating System
Deadlock and memory management -- Operating SystemDeadlock and memory management -- Operating System
Deadlock and memory management -- Operating SystemEktaVaswani2
 
Deadlock in operating systems
Deadlock in operating systemsDeadlock in operating systems
Deadlock in operating systemsjamunaashok
 
Os case study word
Os case study wordOs case study word
Os case study wordDhol Yash
 
The implementation of Banker's algorithm, data structure and its parser
The implementation of Banker's algorithm, data structure and its parserThe implementation of Banker's algorithm, data structure and its parser
The implementation of Banker's algorithm, data structure and its parserMatthew Chang
 
Deadlock detection & prevention
Deadlock detection & preventionDeadlock detection & prevention
Deadlock detection & preventionIkhtiarUddinShaHin
 
4.3 Deadlock [Autosaved].pptx
4.3 Deadlock [Autosaved].pptx4.3 Deadlock [Autosaved].pptx
4.3 Deadlock [Autosaved].pptxDishaDwivedi2
 
Deadlocks in operating system
Deadlocks in operating systemDeadlocks in operating system
Deadlocks in operating systemSara Ali
 
Deadlocks 160928121516-160928183232
Deadlocks 160928121516-160928183232Deadlocks 160928121516-160928183232
Deadlocks 160928121516-160928183232marangburu42
 

Similaire à osvishal-160830131208 (1).pdf (20)

Deadlocks prefinal
Deadlocks prefinalDeadlocks prefinal
Deadlocks prefinal
 
Deadlocksprefinal 161014115456
Deadlocksprefinal 161014115456Deadlocksprefinal 161014115456
Deadlocksprefinal 161014115456
 
Deadlocks final
Deadlocks finalDeadlocks final
Deadlocks final
 
osvzjsjjdndnnssnnsnsndndndnndeadlock.pptx
osvzjsjjdndnnssnnsnsndndndnndeadlock.pptxosvzjsjjdndnnssnnsnsndndndnndeadlock.pptx
osvzjsjjdndnnssnnsnsndndndnndeadlock.pptx
 
Deadlock in Distributed Systems
Deadlock in Distributed SystemsDeadlock in Distributed Systems
Deadlock in Distributed Systems
 
Deadlock's
Deadlock'sDeadlock's
Deadlock's
 
OS 7.pptx
OS 7.pptxOS 7.pptx
OS 7.pptx
 
Ch 4 deadlock
Ch 4 deadlockCh 4 deadlock
Ch 4 deadlock
 
Deadlock and memory management -- Operating System
Deadlock and memory management -- Operating SystemDeadlock and memory management -- Operating System
Deadlock and memory management -- Operating System
 
operating system
operating systemoperating system
operating system
 
operating system
operating systemoperating system
operating system
 
Deadlock in operating systems
Deadlock in operating systemsDeadlock in operating systems
Deadlock in operating systems
 
Os case study word
Os case study wordOs case study word
Os case study word
 
The implementation of Banker's algorithm, data structure and its parser
The implementation of Banker's algorithm, data structure and its parserThe implementation of Banker's algorithm, data structure and its parser
The implementation of Banker's algorithm, data structure and its parser
 
Deadlock detection & prevention
Deadlock detection & preventionDeadlock detection & prevention
Deadlock detection & prevention
 
Unit iv: Deadlocks
Unit iv: DeadlocksUnit iv: Deadlocks
Unit iv: Deadlocks
 
4.3 Deadlock [Autosaved].pptx
4.3 Deadlock [Autosaved].pptx4.3 Deadlock [Autosaved].pptx
4.3 Deadlock [Autosaved].pptx
 
Deadlocks in operating system
Deadlocks in operating systemDeadlocks in operating system
Deadlocks in operating system
 
Gp1242 007 oer ppt
Gp1242 007 oer pptGp1242 007 oer ppt
Gp1242 007 oer ppt
 
Deadlocks 160928121516-160928183232
Deadlocks 160928121516-160928183232Deadlocks 160928121516-160928183232
Deadlocks 160928121516-160928183232
 

Plus de amadayshwan

Page.Replacement.OS.ppt
Page.Replacement.OS.pptPage.Replacement.OS.ppt
Page.Replacement.OS.pptamadayshwan
 
chap.4.memory.manag.ppt
chap.4.memory.manag.pptchap.4.memory.manag.ppt
chap.4.memory.manag.pptamadayshwan
 
chapter10.masss storge.memory management.ppt
chapter10.masss storge.memory management.pptchapter10.masss storge.memory management.ppt
chapter10.masss storge.memory management.pptamadayshwan
 
3 (1) [Autosaved].ppt
3 (1) [Autosaved].ppt3 (1) [Autosaved].ppt
3 (1) [Autosaved].pptamadayshwan
 
Section07-Deadlocks (1).ppt
Section07-Deadlocks (1).pptSection07-Deadlocks (1).ppt
Section07-Deadlocks (1).pptamadayshwan
 
CSS430_Deadlock.pptx
CSS430_Deadlock.pptxCSS430_Deadlock.pptx
CSS430_Deadlock.pptxamadayshwan
 

Plus de amadayshwan (10)

Page.Replacement.OS.ppt
Page.Replacement.OS.pptPage.Replacement.OS.ppt
Page.Replacement.OS.ppt
 
chap.4.memory.manag.ppt
chap.4.memory.manag.pptchap.4.memory.manag.ppt
chap.4.memory.manag.ppt
 
chapter10.masss storge.memory management.ppt
chapter10.masss storge.memory management.pptchapter10.masss storge.memory management.ppt
chapter10.masss storge.memory management.ppt
 
CPU Scheduling
CPU SchedulingCPU Scheduling
CPU Scheduling
 
ch8 (2).ppt
ch8 (2).pptch8 (2).ppt
ch8 (2).ppt
 
3 (1) [Autosaved].ppt
3 (1) [Autosaved].ppt3 (1) [Autosaved].ppt
3 (1) [Autosaved].ppt
 
3 (2).ppt
3 (2).ppt3 (2).ppt
3 (2).ppt
 
Section07-Deadlocks (1).ppt
Section07-Deadlocks (1).pptSection07-Deadlocks (1).ppt
Section07-Deadlocks (1).ppt
 
CSS430_Deadlock.pptx
CSS430_Deadlock.pptxCSS430_Deadlock.pptx
CSS430_Deadlock.pptx
 
Threads.ppt
Threads.pptThreads.ppt
Threads.ppt
 

Dernier

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
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
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
🐬 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
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 

Dernier (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 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 🐘
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

osvishal-160830131208 (1).pdf

  • 2. TOPICS: Deadlock: •Definition •Deadlock Properties and Characteristics •Deadlock Prevention •Deadlock algorithms •Deadlock Detection and Recovery
  • 3. DEADLOCK 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. “Deadlock”
  • 4.
  • 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 AVOIDANCE Avoid actions that may lead to a deadlock. Think of it as a state machine moving from 1 state to another as each instruction is executed. We can avoid the situation of deadlocked by: 1.Safe State 2.Banker’s Algorithm 3.Resource Allocation Graph
  • 7. SAFE STATE Safe state is one where It is not a deadlocked state There is some sequence by which all requests can be satisfied. To avoid deadlocks, we try to make only those transitions that will take you from one safe state to another. We avoid transitions to unsafe state (a state that is not deadlocked, and is not safe).
  • 8. Safe unsafe and deadlock state spaces Unsafe Safe Deadlock
  • 9. BANKER'S ALGORITHM When a request is made, check to see if after the request is satisfied, there is a (at least one!) sequence of moves that can satisfy all the requests ie. the new state is safe. If so, satisfy the request, else make the request wait.
  • 10. RESOURCE ALLOCATION GRAPH If we have a resource allocation system with only one instance of each process, a variant of the resource allocation graph can be used for deadlock avoidance.
  • 11. DEADLOCK PREVENTION 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.
  • 12. 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 process. 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
  • 13. 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 for graph. A system is in deadlock state , if and only if the wait for graph contains cycles. 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.
  • 14. DEADLOCK RECOVERY Once deadlock has been detected, some strategy is needed for recovery. The various approaches of recovering from deadlock are: 1. PROCESS TERMINATION 2. RESOURCE PREEMPTION
  • 15. 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. b) ABORT 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 or not. If no, abort the another process from the deadlock state. Continue this process until we recover from deadlock. This method is also expensive but compare with first one it is better.
  • 16. 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 : 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 state and restart it from that state. c) STARVATION : It must be guaranteed that resource will not always be preempted from the same process to avoid starvation problem.