SlideShare a Scribd company logo
1 of 17
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

More Related Content

What's hot

Methods for handling deadlocks
Methods for handling deadlocksMethods for handling deadlocks
Methods for handling deadlocksA. S. M. Shafi
 
Operating system Dead lock
Operating system Dead lockOperating system Dead lock
Operating system Dead lockKaram Munir Butt
 
Mch7 deadlock
Mch7 deadlockMch7 deadlock
Mch7 deadlockwahab13
 
Dead Lock In Operating Systems
Dead Lock In Operating SystemsDead Lock In Operating Systems
Dead Lock In Operating Systemstotallooser
 
Ch8 OS
Ch8 OSCh8 OS
Ch8 OSC.U
 
Mca ii os u-3 dead lock & io systems
Mca  ii  os u-3 dead lock & io systemsMca  ii  os u-3 dead lock & io systems
Mca ii os u-3 dead lock & io systemsRai University
 
Deadlock Detection in Distributed Systems
Deadlock Detection in Distributed SystemsDeadlock Detection in Distributed Systems
Deadlock Detection in Distributed SystemsDHIVYADEVAKI
 
Deadlock avoidance and prevention .. computer networking
Deadlock avoidance and prevention .. computer networkingDeadlock avoidance and prevention .. computer networking
Deadlock avoidance and prevention .. computer networkingTamannaSharma70
 
Deadlock- Operating System
Deadlock- Operating SystemDeadlock- Operating System
Deadlock- Operating SystemRajan Shah
 
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
 

What's hot (20)

Ch8
Ch8Ch8
Ch8
 
Methods for handling deadlocks
Methods for handling deadlocksMethods for handling deadlocks
Methods for handling deadlocks
 
Deadlock
DeadlockDeadlock
Deadlock
 
Operating system Dead lock
Operating system Dead lockOperating system Dead lock
Operating system Dead lock
 
Mch7 deadlock
Mch7 deadlockMch7 deadlock
Mch7 deadlock
 
Dead Lock In Operating Systems
Dead Lock In Operating SystemsDead Lock In Operating Systems
Dead Lock In Operating Systems
 
Deadlocks
 Deadlocks Deadlocks
Deadlocks
 
Ch8 OS
Ch8 OSCh8 OS
Ch8 OS
 
Bankers
BankersBankers
Bankers
 
Mca ii os u-3 dead lock & io systems
Mca  ii  os u-3 dead lock & io systemsMca  ii  os u-3 dead lock & io systems
Mca ii os u-3 dead lock & io systems
 
Deadlock Detection in Distributed Systems
Deadlock Detection in Distributed SystemsDeadlock Detection in Distributed Systems
Deadlock Detection in Distributed Systems
 
Deadlock
DeadlockDeadlock
Deadlock
 
Deadlock avoidance and prevention .. computer networking
Deadlock avoidance and prevention .. computer networkingDeadlock avoidance and prevention .. computer networking
Deadlock avoidance and prevention .. computer networking
 
Dead Lock
Dead LockDead Lock
Dead Lock
 
Deadlocks
Deadlocks Deadlocks
Deadlocks
 
Deadlock- Operating System
Deadlock- Operating SystemDeadlock- Operating System
Deadlock- Operating System
 
Lect05
Lect05Lect05
Lect05
 
O ssvv62015
O ssvv62015O ssvv62015
O ssvv62015
 
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
DeadlockDeadlock
Deadlock
 

Viewers also liked

thread-clustering
thread-clusteringthread-clustering
thread-clusteringdavidkftam
 
Galvin-operating System(Ch8)
Galvin-operating System(Ch8)Galvin-operating System(Ch8)
Galvin-operating System(Ch8)dsuyal1
 
Lecture5
Lecture5Lecture5
Lecture5jntu
 
C++ Actor Model - You’ve Got Mail ...
C++ Actor Model - You’ve Got Mail ...C++ Actor Model - You’ve Got Mail ...
C++ Actor Model - You’ve Got Mail ...Gianluca Padovani
 
Essentials of Multithreaded System Programming in C++
Essentials of Multithreaded System Programming in C++Essentials of Multithreaded System Programming in C++
Essentials of Multithreaded System Programming in C++Shuo Chen
 
Threads (operating System)
Threads (operating System)Threads (operating System)
Threads (operating System)Prakhar Maurya
 
Operating System 5
Operating System 5Operating System 5
Operating System 5tech2click
 
Unit II - 2 - Operating System - Threads
Unit II - 2 - Operating System - ThreadsUnit II - 2 - Operating System - Threads
Unit II - 2 - Operating System - Threadscscarcas
 
Thread scheduling in Operating Systems
Thread scheduling in Operating SystemsThread scheduling in Operating Systems
Thread scheduling in Operating SystemsNitish Gulati
 
Operating System-Threads-Galvin
Operating System-Threads-GalvinOperating System-Threads-Galvin
Operating System-Threads-GalvinSonali Chauhan
 

Viewers also liked (16)

Java Threading
Java ThreadingJava Threading
Java Threading
 
thread-clustering
thread-clusteringthread-clustering
thread-clustering
 
Galvin-operating System(Ch8)
Galvin-operating System(Ch8)Galvin-operating System(Ch8)
Galvin-operating System(Ch8)
 
Ch05
Ch05Ch05
Ch05
 
Threading
ThreadingThreading
Threading
 
Lecture5
Lecture5Lecture5
Lecture5
 
C++ Actor Model - You’ve Got Mail ...
C++ Actor Model - You’ve Got Mail ...C++ Actor Model - You’ve Got Mail ...
C++ Actor Model - You’ve Got Mail ...
 
Essentials of Multithreaded System Programming in C++
Essentials of Multithreaded System Programming in C++Essentials of Multithreaded System Programming in C++
Essentials of Multithreaded System Programming in C++
 
Threads (operating System)
Threads (operating System)Threads (operating System)
Threads (operating System)
 
Operating System 5
Operating System 5Operating System 5
Operating System 5
 
Unit II - 2 - Operating System - Threads
Unit II - 2 - Operating System - ThreadsUnit II - 2 - Operating System - Threads
Unit II - 2 - Operating System - Threads
 
Thread scheduling in Operating Systems
Thread scheduling in Operating SystemsThread scheduling in Operating Systems
Thread scheduling in Operating Systems
 
Threads in java
Threads in javaThreads in java
Threads in java
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
Operating System-Threads-Galvin
Operating System-Threads-GalvinOperating System-Threads-Galvin
Operating System-Threads-Galvin
 
Os Threads
Os ThreadsOs Threads
Os Threads
 

Similar to Deadlock (20)

Deadlock ppt
Deadlock ppt Deadlock ppt
Deadlock ppt
 
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)
 
Deadlocks
DeadlocksDeadlocks
Deadlocks
 
Deadlock Slides
Deadlock SlidesDeadlock Slides
Deadlock Slides
 
Deadlock
DeadlockDeadlock
Deadlock
 
Rdbms
RdbmsRdbms
Rdbms
 
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
 

More from VISHAL DONGA

Spring Architecture | Advanced Java
Spring Architecture | Advanced JavaSpring Architecture | Advanced Java
Spring Architecture | Advanced JavaVISHAL DONGA
 
JSP Standard Tag Library
JSP Standard Tag LibraryJSP Standard Tag Library
JSP Standard Tag LibraryVISHAL DONGA
 
Vehicle Security System
Vehicle Security SystemVehicle Security System
Vehicle Security SystemVISHAL DONGA
 
Cache memory and cache
Cache memory and cacheCache memory and cache
Cache memory and cacheVISHAL DONGA
 
Newton divided difference interpolation
Newton divided difference interpolationNewton divided difference interpolation
Newton divided difference interpolationVISHAL DONGA
 

More from VISHAL DONGA (8)

Spring Architecture | Advanced Java
Spring Architecture | Advanced JavaSpring Architecture | Advanced Java
Spring Architecture | Advanced Java
 
Hibernate
HibernateHibernate
Hibernate
 
JSP Standard Tag Library
JSP Standard Tag LibraryJSP Standard Tag Library
JSP Standard Tag Library
 
WCF
WCFWCF
WCF
 
Vehicle Security System
Vehicle Security SystemVehicle Security System
Vehicle Security System
 
ipv4
ipv4ipv4
ipv4
 
Cache memory and cache
Cache memory and cacheCache memory and cache
Cache memory and cache
 
Newton divided difference interpolation
Newton divided difference interpolationNewton divided difference interpolation
Newton divided difference interpolation
 

Recently uploaded

AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsvanyagupta248
 
Digital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptxDigital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptxpritamlangde
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaOmar Fathy
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxSCMS School of Architecture
 
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
 
Electromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptxElectromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptxNANDHAKUMARA10
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network DevicesChandrakantDivate1
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdfKamal Acharya
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdfKamal Acharya
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Call Girls Mumbai
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdfAldoGarca30
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
fitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .pptfitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .pptAfnanAhmad53
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.Kamal Acharya
 
UNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxUNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxkalpana413121
 

Recently uploaded (20)

AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
Digital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptxDigital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptx
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
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...
 
Electromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptxElectromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptx
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
fitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .pptfitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .ppt
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
UNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxUNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptx
 
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
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 

Deadlock

  • 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.