operating system
DEADLOCK
 The deadlocks problem
 System model
 Deadlock characterization
 Methods for handling deadlocks
 Deadlock prevention
 Deadlock avoidance
 Deadlock detection
 Recovery from deadlock
INTRODUCTION TO DEADLOCK
Every process needs some resources to complete its
execution. However, the resource is granted in a
sequential order.
 The process requests for some resource.
 OS grant the resource if it is available otherwise let the
process waits.
 The process uses it and release on the completion.
A Deadlock is a situation where each of the computer process
waits for a resource which is being assigned to some another
process.
In this situation, none of the process gets executed since the
resource it needs, is held by some other process which is also
waiting for some other resource to be released.
operating system
METHODS FOR HANDLING DEADLOCKS
Generally speaking, we can deal with the deadlock problem
in one of three ways:
• 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.
 The third solution is the one used by most operating systems,
including Linux and Windows. It is then up to the application
developer to write programs that handle deadlocks.
 Next, we elaborate briefly on each of the three methods for
handling deadlocks. Then, in Sections .we present detailed
algorithms.
 Before proceeding, we should mention that some researchers
have argued that none of the basic approaches alone is
appropriate for the entire spectrum of resource-allocation
problems in operating systems.
 The basic approaches can be combined, however, allowing us
to select an optimal approach for each class of resources in a
system.
 To ensure that deadlocks never occur, the system can use either
a deadlockprevention or a deadlock-avoidance scheme.
 Deadlock prevention provides a set of methods to ensure that
at least one of the necessary conditions (Section 7.2.1) cannot
hold.
 These methods prevent deadlocks by constraining how requests
for resources can be made. We discuss these methods in
Section.
DEADLOCK AVOIDANCE
 Deadlock avoidance requires that the operating system
be given additional information in advance concerning
which resources a process will request and use during its
lifetime.
 With this additional knowledge, the operating system
can decide for each request whether or not the process
should wait.
 To decide whether the current request can be satisfied or
must be delayed, the system must consider the resources
currently available, the resources currently allocated to
each process, and the future requests and releases of each
process. We discuss these schemes in Section.
 If a system does not employ either a deadlock-prevention or a
deadlockavoidance algorithm, then a deadlock situation may
arise.
 In this environment, the system can provide an algorithm that
examines the state of the system to determine whether a
deadlock has occurred and an algorithm to recover from the
deadlock (if a deadlock has indeed occurred). We discuss these
issues in Section
 In the absence of algorithms to detect and recover from
deadlocks, we may arrive at a situation in which the system is
in a deadlocked state yet has no way of recognizing what has
happened.
 In this case, the undetected deadlock will cause the system’s
performance to deteriorate, because resources are being held by
processes that cannot run and because more and more
processes, as they make requests for resources, will enter a
deadlocked state. Eventually, the system will stop functioning
and will need to be restarted manually.
 Although this method may not seem to be a viable approach to
the deadlock problem, it is nevertheless used in most operating
systems, as mentioned earlier.
 Expense is one important consideration.
 Ignoring the possibility of deadlocks is cheaper than the other
approaches. Since in many systems, deadlocks occur
infrequently (say, once per year), the extra expense of the be
put to use to recover from deadlock.
 In some circumstances, a system is in a frozen state but not in
a deadlocked state.
 other methods may not seem worthwhile.
 In addition, methods used to recover from other conditions
may
 We see this situation, for example, with a real-time process
running at the highest priority (or any process running on a
nonpreemptive scheduler) and never returning control to the
operating system.
 The system must have manual recovery methods for such
conditions and may simply use those techniques for deadlock
recovery.

More Related Content

PDF
Apps session wait_tables
PDF
Unit 3 part 2(DEADLOCK)
PPTX
Diagnostic System Monitoring
PPTX
Deadlock Slides
DOCX
Evaluaciones
PPTX
L7 Design For Recovery
PDF
35 dbatune3
Apps session wait_tables
Unit 3 part 2(DEADLOCK)
Diagnostic System Monitoring
Deadlock Slides
Evaluaciones
L7 Design For Recovery
35 dbatune3

Similar to operating system (20)

PPTX
Deadlocks and Deadlock Detection Other Issues
PPTX
Deadlocks
PPTX
DEADLOCK PREVENTION AND AVOIDANCE.pptx
PPTX
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
PPTX
Os presentation final.pptxjjjjjdakajwsjjdhdfjff
PPTX
Lecture 4 Deadlocks in operating systems.pptx
PPTX
Algorithm 4Chapter Four- Deadlock (5).pptx
PPTX
Deadlocks
PPTX
Unit iv: Deadlocks
PPTX
Ch 4 deadlock
PPTX
Deadlock
PDF
osvishal-160830131208 (1).pdf
PPTX
OS Presentation 1 (1).pptx
PPTX
Deadlock detection & prevention
PPTX
osvzjsjjdndnnssnnsnsndndndnndeadlock.pptx
PPTX
OS 7.pptx
PPT
A ppt on deadlock in operating systems for the better explanation
PDF
Section07-Deadlocks.pdf
PPTX
Deadlock - An Operating System Concept.pptx
Deadlocks and Deadlock Detection Other Issues
Deadlocks
DEADLOCK PREVENTION AND AVOIDANCE.pptx
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
Os presentation final.pptxjjjjjdakajwsjjdhdfjff
Lecture 4 Deadlocks in operating systems.pptx
Algorithm 4Chapter Four- Deadlock (5).pptx
Deadlocks
Unit iv: Deadlocks
Ch 4 deadlock
Deadlock
osvishal-160830131208 (1).pdf
OS Presentation 1 (1).pptx
Deadlock detection & prevention
osvzjsjjdndnnssnnsnsndndndnndeadlock.pptx
OS 7.pptx
A ppt on deadlock in operating systems for the better explanation
Section07-Deadlocks.pdf
Deadlock - An Operating System Concept.pptx
Ad

More from renukarenuka9 (20)

PPTX
mobile computing
PPTX
PPTX
Compiler design
PPTX
Web programming
PPTX
Software engineering
PPTX
Software engineering
PPTX
Software engineering
PPTX
Bigdata
PPTX
Bigdata ppt
PPTX
PPTX
PPTX
operating system
PPTX
PPTX
OPERATING SYSTEM
PPTX
Data mining
PPTX
Computer network
PPTX
computer network
PPTX
operating system
PPTX
data mining
PPTX
COMPUTER NETWORK
mobile computing
Compiler design
Web programming
Software engineering
Software engineering
Software engineering
Bigdata
Bigdata ppt
operating system
OPERATING SYSTEM
Data mining
Computer network
computer network
operating system
data mining
COMPUTER NETWORK
Ad

Recently uploaded (20)

PPTX
Heart Lung Preparation_Pressure_Volume.pptx
PPTX
Thyroid disorders presentation for MBBS.pptx
PDF
Social preventive and pharmacy. Pdf
PPTX
Preformulation.pptx Preformulation studies-Including all parameter
PDF
From Molecular Interactions to Solubility in Deep Eutectic Solvents: Explorin...
PPTX
Introduction to Immunology (Unit-1).pptx
PPTX
Targeted drug delivery system 1_44299_BP704T_03-12-2024.pptx
PDF
cell_morphology_organelles_Physiology_ 07_02_2019.pdf
PPT
Chapter 6 Introductory course Biology Camp
PPT
ecg for noob ecg interpretation ecg recall
PPTX
LIPID & AMINO ACID METABOLISM UNIT-III, B PHARM II SEMESTER
PDF
The Future of Telehealth: Engineering New Platforms for Care (www.kiu.ac.ug)
PPTX
02_OpenStax_Chemistry_Slides_20180406 copy.pptx
PPTX
Cutaneous tuberculosis Dermatology
PPTX
The Female Reproductive System - Grade 10 ppt
PPTX
diabetes and its complications nephropathy neuropathy
PDF
final prehhhejjehehhehehehebesentation.pdf
PPTX
Spectroscopic Techniques for M Tech Civil Engineerin .pptx
PDF
Sustainable Biology- Scopes, Principles of sustainiability, Sustainable Resou...
PPTX
Basic principles of chromatography techniques
Heart Lung Preparation_Pressure_Volume.pptx
Thyroid disorders presentation for MBBS.pptx
Social preventive and pharmacy. Pdf
Preformulation.pptx Preformulation studies-Including all parameter
From Molecular Interactions to Solubility in Deep Eutectic Solvents: Explorin...
Introduction to Immunology (Unit-1).pptx
Targeted drug delivery system 1_44299_BP704T_03-12-2024.pptx
cell_morphology_organelles_Physiology_ 07_02_2019.pdf
Chapter 6 Introductory course Biology Camp
ecg for noob ecg interpretation ecg recall
LIPID & AMINO ACID METABOLISM UNIT-III, B PHARM II SEMESTER
The Future of Telehealth: Engineering New Platforms for Care (www.kiu.ac.ug)
02_OpenStax_Chemistry_Slides_20180406 copy.pptx
Cutaneous tuberculosis Dermatology
The Female Reproductive System - Grade 10 ppt
diabetes and its complications nephropathy neuropathy
final prehhhejjehehhehehehebesentation.pdf
Spectroscopic Techniques for M Tech Civil Engineerin .pptx
Sustainable Biology- Scopes, Principles of sustainiability, Sustainable Resou...
Basic principles of chromatography techniques

operating system

  • 2. DEADLOCK  The deadlocks problem  System model  Deadlock characterization  Methods for handling deadlocks  Deadlock prevention  Deadlock avoidance  Deadlock detection  Recovery from deadlock
  • 3. INTRODUCTION TO DEADLOCK Every process needs some resources to complete its execution. However, the resource is granted in a sequential order.  The process requests for some resource.  OS grant the resource if it is available otherwise let the process waits.  The process uses it and release on the completion.
  • 4. A Deadlock is a situation where each of the computer process waits for a resource which is being assigned to some another process. In this situation, none of the process gets executed since the resource it needs, is held by some other process which is also waiting for some other resource to be released.
  • 6. METHODS FOR HANDLING DEADLOCKS Generally speaking, we can deal with the deadlock problem in one of three ways: • 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.
  • 7.  The third solution is the one used by most operating systems, including Linux and Windows. It is then up to the application developer to write programs that handle deadlocks.  Next, we elaborate briefly on each of the three methods for handling deadlocks. Then, in Sections .we present detailed algorithms.
  • 8.  Before proceeding, we should mention that some researchers have argued that none of the basic approaches alone is appropriate for the entire spectrum of resource-allocation problems in operating systems.  The basic approaches can be combined, however, allowing us to select an optimal approach for each class of resources in a system.
  • 9.  To ensure that deadlocks never occur, the system can use either a deadlockprevention or a deadlock-avoidance scheme.  Deadlock prevention provides a set of methods to ensure that at least one of the necessary conditions (Section 7.2.1) cannot hold.  These methods prevent deadlocks by constraining how requests for resources can be made. We discuss these methods in Section.
  • 10. DEADLOCK AVOIDANCE  Deadlock avoidance requires that the operating system be given additional information in advance concerning which resources a process will request and use during its lifetime.  With this additional knowledge, the operating system can decide for each request whether or not the process should wait.  To decide whether the current request can be satisfied or must be delayed, the system must consider the resources currently available, the resources currently allocated to each process, and the future requests and releases of each process. We discuss these schemes in Section.
  • 11.  If a system does not employ either a deadlock-prevention or a deadlockavoidance algorithm, then a deadlock situation may arise.  In this environment, the system can provide an algorithm that examines the state of the system to determine whether a deadlock has occurred and an algorithm to recover from the deadlock (if a deadlock has indeed occurred). We discuss these issues in Section
  • 12.  In the absence of algorithms to detect and recover from deadlocks, we may arrive at a situation in which the system is in a deadlocked state yet has no way of recognizing what has happened.  In this case, the undetected deadlock will cause the system’s performance to deteriorate, because resources are being held by processes that cannot run and because more and more processes, as they make requests for resources, will enter a deadlocked state. Eventually, the system will stop functioning and will need to be restarted manually.
  • 13.  Although this method may not seem to be a viable approach to the deadlock problem, it is nevertheless used in most operating systems, as mentioned earlier.  Expense is one important consideration.  Ignoring the possibility of deadlocks is cheaper than the other approaches. Since in many systems, deadlocks occur infrequently (say, once per year), the extra expense of the be put to use to recover from deadlock.  In some circumstances, a system is in a frozen state but not in a deadlocked state.  other methods may not seem worthwhile.  In addition, methods used to recover from other conditions may
  • 14.  We see this situation, for example, with a real-time process running at the highest priority (or any process running on a nonpreemptive scheduler) and never returning control to the operating system.  The system must have manual recovery methods for such conditions and may simply use those techniques for deadlock recovery.