SlideShare a Scribd company logo
1
Presentation On
Presented By
Ikhtiar Uddin – 191902022
Sajib Chandra Paul – 191902013
Md. Mohshin Khan – 191902010
Asma Akter – 191902027
Ayesha Akter – 191902049
Jakia Akter – 191902046
2
Presented To
Umme Habiba
Lecturer, Dept of CSE
Green University of Bangladesh
Agenda
 Definition of Deadlock
 Deadlock Characterization
 Strategies for handeling Deadlock
 Types of Deadlock
 Deadlock Condition
 Deadlock Prevention
 Deadlock Detection
 Deadlock Recovery
3
Deadlock
In an operating system, a deadlock occurs when a process or thread enters a
waiting state because a requested system resource is held by another waiting
process, which in turn is waiting for another resource held by another waiting
process.
4
Deadlock Characterization
Mutual Exclusion:
There should be a resource that can only be held by one process at a time.
5
Deadlock Characterization (cont...)
Hold and Wait:
A process can hold multiple resources and still request more resources from
other processes which are holding them.
6
Deadlock Characterization (cont...)
No Preemption:
A resource cannot be preempted from a process by force. A process can only
release a resource voluntarily.
7
Deadlock Characterization (cont...)
Circular Wait:
A process is waiting for the resource held by the second process, which is
waiting for the resource held by the third process and so on, till the last
process is waiting for a resource held by the first process. This forms a circular
chain.
8
Strategies for handling deadlocks
 Deadlock prevention. Prevents deadlocks by restraining requests made to
ensure that at least one of the four deadlock conditions cannot occur.
 Deadlock avoidance. Dynamically grants a resource to a process if the
resulting state is safe. A state is safe if there is at least one execution
sequence that allows all processes to run to completion.
 Deadlock detection and recovery. Allows deadlocks to form; then finds and
breaks them.
9
Resource-Allocation Graph With
Example:
10
Resource Allocation Graph With A
Deadlock
11
Graph With A Cycle But No Deadlock 12
Two types of deadlocks
 Resource deadlock: uses AND condition.
AND condition: a process that requires resources for execution can
proceed when it has acquired all those resources.
 Communication deadlock: uses OR condition.
OR condition: a process that requires resources for execution can
proceed when it has acquired at least one of those resources.
13
Deadlock conditions
The condition for deadlock in a system using the AND condition is the
existence of a cycle.
The condition for deadlock in a system using the OR condition is the
existence of a knot.
A knot (K) consists of a set of nodes such that for every node a in K, all nodes
in K and only the nodes in K are reachable from node a.
Example: OR condition
14
Deadlock Prevention
1. A process acquires all the needed resources simultaneously before it begins
its execution, therefore breaking the hold and wait condition.
Drawback: over-cautious.
2. All resources are assigned unique numbers. A process may request a
resource with a unique number I only if it is not holding a resource with a
number less than or equal to I and therefore breaking the circular wait
condition.
Drawback: over-cautions.
15
Deadlock Prevention (Cont…)
3. Each process is assigned a unique priority number. The priority numbers
decide whether process Pi should wait for process Pj and therefore break the
non-preemption condition.
Drawback: starvation. The lower priority one may always be rolled back.
Solution is to raise the priority every time it is victimized.
4. Practically it is impossible to provide a method to break the mutual
exclusion condition since most resources are intrinsically non-sharable,
16
Deadlock Detection
o If resources have single instance:
In this case for Deadlock detection we can run an algorithm to check for cycle
in the Resource Allocation Graph. Presence of cycle in the graph is the
sufficient condition for deadlock.
17
Deadlock Detection (Cont…)
o If there are multiple instances of resources:
Detection of the cycle is necessary but not sufficient condition for
deadlock detection, in this case, the system may or may not be in deadlock
varies according to different situations.
18
Deadlock Recovery
Recovery method >>
Killing the process: killing all the process involved in the deadlock. Killing
process one by one. After killing each process check for deadlock again keep
repeating the process till system recover from deadlock.
Resource Preemption: Resources are preempted from the processes involved
in the deadlock, preempted resources are allocated to other processes so that
there is a possibility of recovering the system from deadlock. In this case, the
system goes into starvation.
19
Thank You
20
Any Question 21

More Related Content

What's hot

Deadlock Prevention
Deadlock PreventionDeadlock Prevention
Deadlock Prevention
prachi mewara
 
Bankers
BankersBankers
deadlock avoidance
deadlock avoidancedeadlock avoidance
deadlock avoidance
wahab13
 
Deadlock Avoidance in Operating System
Deadlock Avoidance in Operating SystemDeadlock Avoidance in Operating System
Deadlock Avoidance in Operating System
Mohammad Hafiz-Al-Masud
 
Deadlock Avoidance - OS
Deadlock Avoidance - OSDeadlock Avoidance - OS
Deadlock Avoidance - OS
MsAnita2
 
Process synchronization
Process synchronizationProcess synchronization
Process synchronization
Syed Hassan Ali
 
Dead Lock
Dead LockDead Lock
Dead Lock
Ramasubbu .P
 
Operating System: Deadlock
Operating System: DeadlockOperating System: Deadlock
Operating System: Deadlock
InteX Research Lab
 
Chapter 3: Processes
Chapter 3: ProcessesChapter 3: Processes
Chapter 3: Processes
Shafaan Khaliq Bhatti
 
Operating system Dead lock
Operating system Dead lockOperating system Dead lock
Operating system Dead lock
Karam Munir Butt
 
deadlock handling
deadlock handlingdeadlock handling
deadlock handling
Suraj Kumar
 
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
अनिकेत चौधरी
 
Os Threads
Os ThreadsOs Threads
Os Threads
Salman Memon
 
Unit II - 3 - Operating System - Process Synchronization
Unit II - 3 - Operating System - Process SynchronizationUnit II - 3 - Operating System - Process Synchronization
Unit II - 3 - Operating System - Process Synchronization
cscarcas
 
Deadlock
DeadlockDeadlock
Deadlock
Mohd Arif
 
Deadlock
DeadlockDeadlock
Deadlock
Sajan Sahu
 
8. mutual exclusion in Distributed Operating Systems
8. mutual exclusion in Distributed Operating Systems8. mutual exclusion in Distributed Operating Systems
8. mutual exclusion in Distributed Operating Systems
Dr Sandeep Kumar Poonia
 
Distributed Deadlock Detection.ppt
Distributed Deadlock Detection.pptDistributed Deadlock Detection.ppt
Distributed Deadlock Detection.ppt
Babar Kamran Ahmed (LION)
 
Methods for handling deadlocks
Methods for handling deadlocksMethods for handling deadlocks
Methods for handling deadlocks
A. S. M. Shafi
 
Threads (operating System)
Threads (operating System)Threads (operating System)
Threads (operating System)
Prakhar Maurya
 

What's hot (20)

Deadlock Prevention
Deadlock PreventionDeadlock Prevention
Deadlock Prevention
 
Bankers
BankersBankers
Bankers
 
deadlock avoidance
deadlock avoidancedeadlock avoidance
deadlock avoidance
 
Deadlock Avoidance in Operating System
Deadlock Avoidance in Operating SystemDeadlock Avoidance in Operating System
Deadlock Avoidance in Operating System
 
Deadlock Avoidance - OS
Deadlock Avoidance - OSDeadlock Avoidance - OS
Deadlock Avoidance - OS
 
Process synchronization
Process synchronizationProcess synchronization
Process synchronization
 
Dead Lock
Dead LockDead Lock
Dead Lock
 
Operating System: Deadlock
Operating System: DeadlockOperating System: Deadlock
Operating System: Deadlock
 
Chapter 3: Processes
Chapter 3: ProcessesChapter 3: Processes
Chapter 3: Processes
 
Operating system Dead lock
Operating system Dead lockOperating system Dead lock
Operating system Dead lock
 
deadlock handling
deadlock handlingdeadlock handling
deadlock handling
 
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
 
Os Threads
Os ThreadsOs Threads
Os Threads
 
Unit II - 3 - Operating System - Process Synchronization
Unit II - 3 - Operating System - Process SynchronizationUnit II - 3 - Operating System - Process Synchronization
Unit II - 3 - Operating System - Process Synchronization
 
Deadlock
DeadlockDeadlock
Deadlock
 
Deadlock
DeadlockDeadlock
Deadlock
 
8. mutual exclusion in Distributed Operating Systems
8. mutual exclusion in Distributed Operating Systems8. mutual exclusion in Distributed Operating Systems
8. mutual exclusion in Distributed Operating Systems
 
Distributed Deadlock Detection.ppt
Distributed Deadlock Detection.pptDistributed Deadlock Detection.ppt
Distributed Deadlock Detection.ppt
 
Methods for handling deadlocks
Methods for handling deadlocksMethods for handling deadlocks
Methods for handling deadlocks
 
Threads (operating System)
Threads (operating System)Threads (operating System)
Threads (operating System)
 

Similar to Deadlock detection & prevention

Ch 4 deadlock
Ch 4 deadlockCh 4 deadlock
Ch 4 deadlock
madhuributani
 
Deadlock
DeadlockDeadlock
Os case study word
Os case study wordOs case study word
Os case study word
Dhol Yash
 
Operating system Deadlock
Operating system DeadlockOperating system Deadlock
Deadlocks
DeadlocksDeadlocks
Deadlocks
Zahid Ali
 
Deadlocks final
Deadlocks finalDeadlocks final
Deadlocks final
marangburu42
 
Deadlocks by wani zahoor
Deadlocks by wani zahoorDeadlocks by wani zahoor
Deadlocks by wani zahoor
Wani Zahoor
 
osvishal-160830131208 (1).pdf
osvishal-160830131208 (1).pdfosvishal-160830131208 (1).pdf
osvishal-160830131208 (1).pdf
amadayshwan
 
Deadlock
DeadlockDeadlock
Deadlock
VISHAL DONGA
 
FP 202 Chapter 2 - Part 3
FP 202 Chapter 2 - Part 3FP 202 Chapter 2 - Part 3
FP 202 Chapter 2 - Part 3
rohassanie
 
Gp1242 007 oer ppt
Gp1242 007 oer pptGp1242 007 oer ppt
Gp1242 007 oer ppt
Nivedita Kasturi
 
Deadlocks
DeadlocksDeadlocks
Deadlocks
Dilum Bandara
 
Deadlocks.ppt
Deadlocks.pptDeadlocks.ppt
Deadlocks.ppt
jamilmalik19
 
Deadlocks prefinal
Deadlocks prefinalDeadlocks prefinal
Deadlocks prefinal
marangburu42
 
Deadlocksprefinal 161014115456
Deadlocksprefinal 161014115456Deadlocksprefinal 161014115456
Deadlocksprefinal 161014115456
marangburu42
 
Deadlockpresentation.pptx
Deadlockpresentation.pptxDeadlockpresentation.pptx
Deadlockpresentation.pptx
KARMVIR6
 
Deadlock Slides
Deadlock SlidesDeadlock Slides
Deadlock Slides
sehrishishaq1
 
Section07-Deadlocks (1).ppt
Section07-Deadlocks (1).pptSection07-Deadlocks (1).ppt
Section07-Deadlocks (1).ppt
amadayshwan
 
Section07-Deadlocks_operating_system.ppt
Section07-Deadlocks_operating_system.pptSection07-Deadlocks_operating_system.ppt
Section07-Deadlocks_operating_system.ppt
jbri1395
 
Deadlocks
DeadlocksDeadlocks
Deadlocks
Sakshi Tiwari
 

Similar to Deadlock detection & prevention (20)

Ch 4 deadlock
Ch 4 deadlockCh 4 deadlock
Ch 4 deadlock
 
Deadlock
DeadlockDeadlock
Deadlock
 
Os case study word
Os case study wordOs case study word
Os case study word
 
Operating system Deadlock
Operating system DeadlockOperating system Deadlock
Operating system Deadlock
 
Deadlocks
DeadlocksDeadlocks
Deadlocks
 
Deadlocks final
Deadlocks finalDeadlocks final
Deadlocks final
 
Deadlocks by wani zahoor
Deadlocks by wani zahoorDeadlocks by wani zahoor
Deadlocks by wani zahoor
 
osvishal-160830131208 (1).pdf
osvishal-160830131208 (1).pdfosvishal-160830131208 (1).pdf
osvishal-160830131208 (1).pdf
 
Deadlock
DeadlockDeadlock
Deadlock
 
FP 202 Chapter 2 - Part 3
FP 202 Chapter 2 - Part 3FP 202 Chapter 2 - Part 3
FP 202 Chapter 2 - Part 3
 
Gp1242 007 oer ppt
Gp1242 007 oer pptGp1242 007 oer ppt
Gp1242 007 oer ppt
 
Deadlocks
DeadlocksDeadlocks
Deadlocks
 
Deadlocks.ppt
Deadlocks.pptDeadlocks.ppt
Deadlocks.ppt
 
Deadlocks prefinal
Deadlocks prefinalDeadlocks prefinal
Deadlocks prefinal
 
Deadlocksprefinal 161014115456
Deadlocksprefinal 161014115456Deadlocksprefinal 161014115456
Deadlocksprefinal 161014115456
 
Deadlockpresentation.pptx
Deadlockpresentation.pptxDeadlockpresentation.pptx
Deadlockpresentation.pptx
 
Deadlock Slides
Deadlock SlidesDeadlock Slides
Deadlock Slides
 
Section07-Deadlocks (1).ppt
Section07-Deadlocks (1).pptSection07-Deadlocks (1).ppt
Section07-Deadlocks (1).ppt
 
Section07-Deadlocks_operating_system.ppt
Section07-Deadlocks_operating_system.pptSection07-Deadlocks_operating_system.ppt
Section07-Deadlocks_operating_system.ppt
 
Deadlocks
DeadlocksDeadlocks
Deadlocks
 

Recently uploaded

Recycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part IIRecycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part II
Aditya Rajan Patra
 
Textile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdfTextile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdf
NazakatAliKhoso2
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Sinan KOZAK
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
NidhalKahouli2
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
Victor Morales
 
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
University of Maribor
 
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have oneISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
Las Vegas Warehouse
 
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptxML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
JamalHussainArman
 
Casting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdfCasting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdf
zubairahmad848137
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
IJECEIAES
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
Yasser Mahgoub
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
abbyasa1014
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
Hitesh Mohapatra
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
MIGUELANGEL966976
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
TIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEM
TIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEMTIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEM
TIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEM
HODECEDSIET
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
Madan Karki
 

Recently uploaded (20)

Recycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part IIRecycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part II
 
Textile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdfTextile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdf
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
 
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
 
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have oneISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
 
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptxML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
 
Casting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdfCasting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdf
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
TIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEM
TIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEMTIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEM
TIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEM
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
 

Deadlock detection & prevention

  • 2. Presented By Ikhtiar Uddin – 191902022 Sajib Chandra Paul – 191902013 Md. Mohshin Khan – 191902010 Asma Akter – 191902027 Ayesha Akter – 191902049 Jakia Akter – 191902046 2 Presented To Umme Habiba Lecturer, Dept of CSE Green University of Bangladesh
  • 3. Agenda  Definition of Deadlock  Deadlock Characterization  Strategies for handeling Deadlock  Types of Deadlock  Deadlock Condition  Deadlock Prevention  Deadlock Detection  Deadlock Recovery 3
  • 4. Deadlock In an operating system, a deadlock occurs when a process or thread enters a waiting state because a requested system resource is held by another waiting process, which in turn is waiting for another resource held by another waiting process. 4
  • 5. Deadlock Characterization Mutual Exclusion: There should be a resource that can only be held by one process at a time. 5
  • 6. Deadlock Characterization (cont...) Hold and Wait: A process can hold multiple resources and still request more resources from other processes which are holding them. 6
  • 7. Deadlock Characterization (cont...) No Preemption: A resource cannot be preempted from a process by force. A process can only release a resource voluntarily. 7
  • 8. Deadlock Characterization (cont...) Circular Wait: A process is waiting for the resource held by the second process, which is waiting for the resource held by the third process and so on, till the last process is waiting for a resource held by the first process. This forms a circular chain. 8
  • 9. Strategies for handling deadlocks  Deadlock prevention. Prevents deadlocks by restraining requests made to ensure that at least one of the four deadlock conditions cannot occur.  Deadlock avoidance. Dynamically grants a resource to a process if the resulting state is safe. A state is safe if there is at least one execution sequence that allows all processes to run to completion.  Deadlock detection and recovery. Allows deadlocks to form; then finds and breaks them. 9
  • 11. Resource Allocation Graph With A Deadlock 11
  • 12. Graph With A Cycle But No Deadlock 12
  • 13. Two types of deadlocks  Resource deadlock: uses AND condition. AND condition: a process that requires resources for execution can proceed when it has acquired all those resources.  Communication deadlock: uses OR condition. OR condition: a process that requires resources for execution can proceed when it has acquired at least one of those resources. 13
  • 14. Deadlock conditions The condition for deadlock in a system using the AND condition is the existence of a cycle. The condition for deadlock in a system using the OR condition is the existence of a knot. A knot (K) consists of a set of nodes such that for every node a in K, all nodes in K and only the nodes in K are reachable from node a. Example: OR condition 14
  • 15. Deadlock Prevention 1. A process acquires all the needed resources simultaneously before it begins its execution, therefore breaking the hold and wait condition. Drawback: over-cautious. 2. All resources are assigned unique numbers. A process may request a resource with a unique number I only if it is not holding a resource with a number less than or equal to I and therefore breaking the circular wait condition. Drawback: over-cautions. 15
  • 16. Deadlock Prevention (Cont…) 3. Each process is assigned a unique priority number. The priority numbers decide whether process Pi should wait for process Pj and therefore break the non-preemption condition. Drawback: starvation. The lower priority one may always be rolled back. Solution is to raise the priority every time it is victimized. 4. Practically it is impossible to provide a method to break the mutual exclusion condition since most resources are intrinsically non-sharable, 16
  • 17. Deadlock Detection o If resources have single instance: In this case for Deadlock detection we can run an algorithm to check for cycle in the Resource Allocation Graph. Presence of cycle in the graph is the sufficient condition for deadlock. 17
  • 18. Deadlock Detection (Cont…) o If there are multiple instances of resources: Detection of the cycle is necessary but not sufficient condition for deadlock detection, in this case, the system may or may not be in deadlock varies according to different situations. 18
  • 19. Deadlock Recovery Recovery method >> Killing the process: killing all the process involved in the deadlock. Killing process one by one. After killing each process check for deadlock again keep repeating the process till system recover from deadlock. Resource Preemption: Resources are preempted from the processes involved in the deadlock, preempted resources are allocated to other processes so that there is a possibility of recovering the system from deadlock. In this case, the system goes into starvation. 19