SlideShare a Scribd company logo
Unit 3 – Part 1
Deadlock
Deadlock
Deadlock is a situation where a set of processes are
blocked because each process is holding a resource and
waiting for another resource acquired by some other
process.
Consider an example when two trains are coming toward
each other on same track and there is only one track,
none of the trains can move once they are in front of
each other. Similar situation occurs in operating systems
when there are two or more processes hold some
resources and wait for resources held by other(s). For
example, in the below diagram, Process 1 is holding
Resource 1 and waiting for resource 2 which is acquired
by process 2, and process 2 is waiting for resource 1.
Deadlock can arise if following four
Coffman Conditions
A deadlock occurs if the four Coffman conditions
hold true. But these conditions are not mutually
exclusive.
The Coffman conditions are given as follows
• Mutual Exclusion
• Hold and Wait
• No Preemption
• Circular Wait
Mutual Exclusion
There should be a resource that can only be held by one
process at a time. In the diagram below, there is a single
instance of Resource 1 and it is held by Process 1 only.
The resources involved are non-shareable
Explanation: At least one resource (thread) must be held
in a non-shareable mode. that is, only one process at a
time claims exclusive control of the resource.
If another process requests that resource, the requesting
process must be delayed until the resource has been
released.
Hold and Wait
A process can hold multiple resources and still
request more resources from other processes which
are holding them. In the diagram given below,
Process 2 holds Resource 2 and Resource 3 and is
requesting the Resource 1 which is held by Process 1.
No Preemption
A resource cannot be preempted from a process by force.
A process can only release a resource voluntarily. In the
diagram below, Process 2 cannot preempt Resource 1
from Process 1. It will only be released when Process 1
give it up voluntarily after its execution is complete.
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. For example:
Process 1 is allocated Resource2 and it is requesting
Resource 1. Similarly, Process 2 is allocated Resource
1 and it is requesting Resource 2. This forms a
circular wait loop.
As an example, consider the traffic
deadlock in the following figure
Consider each section of the street as a resource.
• Mutual exclusion condition applies, since only one
vehicle can be on a section of the street at a time.
• Hold-and-wait condition applies, since each vehicle is
occupying a section of the street, and waiting to move
on to the next section of the street.
• No-preemptive condition applies, since a section of the
street that is a section of the street that is occupied by a
vehicle cannot be taken away from it.
• Circular wait condition applies, since each vehicle is
waiting on the next vehicle to move. That is, each
vehicle in the traffic is waiting for a section of street
held by the next vehicle in the traffic.

More Related Content

Similar to Unit 3 part 1(DEADLOCK)

OS Unit 3.pptx
OS Unit 3.pptxOS Unit 3.pptx
OS Unit 3.pptx
GautamBorana
 
3.6 Deadlock-operating system unit 3.pptx
3.6 Deadlock-operating system unit 3.pptx3.6 Deadlock-operating system unit 3.pptx
3.6 Deadlock-operating system unit 3.pptx
svulasal
 
Deadlock
DeadlockDeadlock
DEADLOCK
DEADLOCKDEADLOCK
Deadlocks by wani zahoor
Deadlocks by wani zahoorDeadlocks by wani zahoor
Deadlocks by wani zahoor
Wani Zahoor
 
Deadlock in operating systems
Deadlock in operating systemsDeadlock in operating systems
Deadlock in operating systems
jamunaashok
 
Ch 4 deadlock
Ch 4 deadlockCh 4 deadlock
Ch 4 deadlock
madhuributani
 
Deadlocks
DeadlocksDeadlocks
Deadlocks
Zahid Ali
 
OS deadlock.pptx
OS deadlock.pptxOS deadlock.pptx
OS deadlock.pptx
rpbbhalerao2000
 
AS1- Four Condition of Deadloc- show that the four conditions of deadl.docx
AS1- Four Condition of Deadloc- show that the four conditions of deadl.docxAS1- Four Condition of Deadloc- show that the four conditions of deadl.docx
AS1- Four Condition of Deadloc- show that the four conditions of deadl.docx
james876543264
 
Deadlocks.ppt
Deadlocks.pptDeadlocks.ppt
Deadlocks.ppt
jamilmalik19
 
Deadlock detection & prevention
Deadlock detection & preventionDeadlock detection & prevention
Deadlock detection & prevention
IkhtiarUddinShaHin
 

Similar to Unit 3 part 1(DEADLOCK) (12)

OS Unit 3.pptx
OS Unit 3.pptxOS Unit 3.pptx
OS Unit 3.pptx
 
3.6 Deadlock-operating system unit 3.pptx
3.6 Deadlock-operating system unit 3.pptx3.6 Deadlock-operating system unit 3.pptx
3.6 Deadlock-operating system unit 3.pptx
 
Deadlock
DeadlockDeadlock
Deadlock
 
DEADLOCK
DEADLOCKDEADLOCK
DEADLOCK
 
Deadlocks by wani zahoor
Deadlocks by wani zahoorDeadlocks by wani zahoor
Deadlocks by wani zahoor
 
Deadlock in operating systems
Deadlock in operating systemsDeadlock in operating systems
Deadlock in operating systems
 
Ch 4 deadlock
Ch 4 deadlockCh 4 deadlock
Ch 4 deadlock
 
Deadlocks
DeadlocksDeadlocks
Deadlocks
 
OS deadlock.pptx
OS deadlock.pptxOS deadlock.pptx
OS deadlock.pptx
 
AS1- Four Condition of Deadloc- show that the four conditions of deadl.docx
AS1- Four Condition of Deadloc- show that the four conditions of deadl.docxAS1- Four Condition of Deadloc- show that the four conditions of deadl.docx
AS1- Four Condition of Deadloc- show that the four conditions of deadl.docx
 
Deadlocks.ppt
Deadlocks.pptDeadlocks.ppt
Deadlocks.ppt
 
Deadlock detection & prevention
Deadlock detection & preventionDeadlock detection & prevention
Deadlock detection & prevention
 

More from WajeehaBaig

File system
File systemFile system
File system
WajeehaBaig
 
Unit 3 part 2(DEADLOCK)
Unit 3 part 2(DEADLOCK)Unit 3 part 2(DEADLOCK)
Unit 3 part 2(DEADLOCK)
WajeehaBaig
 
Unit 2 part 2(Process)
Unit 2 part 2(Process)Unit 2 part 2(Process)
Unit 2 part 2(Process)
WajeehaBaig
 
Unit 2 part 1(Process)
Unit 2 part 1(Process)Unit 2 part 1(Process)
Unit 2 part 1(Process)
WajeehaBaig
 
lecture 1 (Part 2) kernal and its categories
lecture 1 (Part 2) kernal and its categorieslecture 1 (Part 2) kernal and its categories
lecture 1 (Part 2) kernal and its categories
WajeehaBaig
 
lecture 1 (Introduction to Operating System.)
lecture 1 (Introduction to Operating System.)lecture 1 (Introduction to Operating System.)
lecture 1 (Introduction to Operating System.)
WajeehaBaig
 

More from WajeehaBaig (6)

File system
File systemFile system
File system
 
Unit 3 part 2(DEADLOCK)
Unit 3 part 2(DEADLOCK)Unit 3 part 2(DEADLOCK)
Unit 3 part 2(DEADLOCK)
 
Unit 2 part 2(Process)
Unit 2 part 2(Process)Unit 2 part 2(Process)
Unit 2 part 2(Process)
 
Unit 2 part 1(Process)
Unit 2 part 1(Process)Unit 2 part 1(Process)
Unit 2 part 1(Process)
 
lecture 1 (Part 2) kernal and its categories
lecture 1 (Part 2) kernal and its categorieslecture 1 (Part 2) kernal and its categories
lecture 1 (Part 2) kernal and its categories
 
lecture 1 (Introduction to Operating System.)
lecture 1 (Introduction to Operating System.)lecture 1 (Introduction to Operating System.)
lecture 1 (Introduction to Operating System.)
 

Recently uploaded

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
 
AI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptxAI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptx
architagupta876
 
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by AnantLLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
Anant Corporation
 
Welding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdfWelding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdf
AjmalKhan50578
 
ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
VANDANAMOHANGOUDA
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...
bijceesjournal
 
An improved modulation technique suitable for a three level flying capacitor ...
An improved modulation technique suitable for a three level flying capacitor ...An improved modulation technique suitable for a three level flying capacitor ...
An improved modulation technique suitable for a three level flying capacitor ...
IJECEIAES
 
An Introduction to the Compiler Designss
An Introduction to the Compiler DesignssAn Introduction to the Compiler Designss
An Introduction to the Compiler Designss
ElakkiaU
 
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
 
Curve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods RegressionCurve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods Regression
Nada Hikmah
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
co23btech11018
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 
artificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptxartificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptx
GauravCar
 
Material for memory and display system h
Material for memory and display system hMaterial for memory and display system h
Material for memory and display system h
gowrishankartb2005
 
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
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
bijceesjournal
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
Divyanshu
 
cnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classicationcnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classication
SakkaravarthiShanmug
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
171ticu
 

Recently uploaded (20)

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...
 
AI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptxAI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptx
 
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by AnantLLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
 
Welding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdfWelding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdf
 
ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...
 
An improved modulation technique suitable for a three level flying capacitor ...
An improved modulation technique suitable for a three level flying capacitor ...An improved modulation technique suitable for a three level flying capacitor ...
An improved modulation technique suitable for a three level flying capacitor ...
 
An Introduction to the Compiler Designss
An Introduction to the Compiler DesignssAn Introduction to the Compiler Designss
An Introduction to the Compiler Designss
 
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
 
Curve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods RegressionCurve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods Regression
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 
artificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptxartificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptx
 
Material for memory and display system h
Material for memory and display system hMaterial for memory and display system h
Material for memory and display system h
 
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
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
 
cnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classicationcnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classication
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
 

Unit 3 part 1(DEADLOCK)

  • 1. Unit 3 – Part 1 Deadlock
  • 2. Deadlock Deadlock is a situation where a set of processes are blocked because each process is holding a resource and waiting for another resource acquired by some other process. Consider an example when two trains are coming toward each other on same track and there is only one track, none of the trains can move once they are in front of each other. Similar situation occurs in operating systems when there are two or more processes hold some resources and wait for resources held by other(s). For example, in the below diagram, Process 1 is holding Resource 1 and waiting for resource 2 which is acquired by process 2, and process 2 is waiting for resource 1.
  • 3.
  • 4. Deadlock can arise if following four Coffman Conditions A deadlock occurs if the four Coffman conditions hold true. But these conditions are not mutually exclusive. The Coffman conditions are given as follows • Mutual Exclusion • Hold and Wait • No Preemption • Circular Wait
  • 5. Mutual Exclusion There should be a resource that can only be held by one process at a time. In the diagram below, there is a single instance of Resource 1 and it is held by Process 1 only. The resources involved are non-shareable Explanation: At least one resource (thread) must be held in a non-shareable mode. that is, only one process at a time claims exclusive control of the resource. If another process requests that resource, the requesting process must be delayed until the resource has been released.
  • 6. Hold and Wait A process can hold multiple resources and still request more resources from other processes which are holding them. In the diagram given below, Process 2 holds Resource 2 and Resource 3 and is requesting the Resource 1 which is held by Process 1.
  • 7. No Preemption A resource cannot be preempted from a process by force. A process can only release a resource voluntarily. In the diagram below, Process 2 cannot preempt Resource 1 from Process 1. It will only be released when Process 1 give it up voluntarily after its execution is complete.
  • 8. 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. For example: Process 1 is allocated Resource2 and it is requesting Resource 1. Similarly, Process 2 is allocated Resource 1 and it is requesting Resource 2. This forms a circular wait loop.
  • 9. As an example, consider the traffic deadlock in the following figure
  • 10. Consider each section of the street as a resource. • Mutual exclusion condition applies, since only one vehicle can be on a section of the street at a time. • Hold-and-wait condition applies, since each vehicle is occupying a section of the street, and waiting to move on to the next section of the street. • No-preemptive condition applies, since a section of the street that is a section of the street that is occupied by a vehicle cannot be taken away from it. • Circular wait condition applies, since each vehicle is waiting on the next vehicle to move. That is, each vehicle in the traffic is waiting for a section of street held by the next vehicle in the traffic.