SlideShare a Scribd company logo
8/13/2017
1
Welcome
to
our presentation
on
Deadlock
Presented by:
Md. Sohag
Em@il : sohag.0315@gmail.com
Presented to:
Deadlock
2
8/13/2017
What is Deadlock ?
 A set of blocked processes each holding a resource and waiting to
acquire a resource held by another process in the set.
 Example
2 train approaches each other at crossing, both will come to full
stop and neither shall start until other has gone.
8/13/2017
3
Deadlock Example
 Traffic only in one direction.
 Each section of a bridge can be viewed as a resource.
 If a deadlock occurs, it can be resolved if one car backs up .
 Several cars may have to be backed up if a deadlock occurs. 8/13/2017
4
DEADLOCK CHARACTERIZATION
 Deadlock can arise if four conditions hold simultaneously.
 Mutual exclusion
 Hold and wait
 No preemption
 Circular wait
8/13/2017
5
RESOURCE-ALLOCATION GRAPH
 Deadlocks can be described in term of directed graph- SYSTEM RESOURCE-
ALLOCATION GRAPH.
 Process
 Resource Type with 4 instances
 Pi requests instance of Rj
 Pi is holding an instance of Rj
p
Pi
Rj
Pi
Rj
8/13/2017
6
EXAMPLE OF RESOURCE-ALLOCATION GRAPH
8/13/2017
7
p3
p1 p2
R2
R1 R3
R4
RESOURCE-ALLOCATIONGRAPH AND A DEADLOCK
8/13/2017
8
METHODS FOR HANDLINGDEADLOCK
 We can deal with DL problem in 3-ways:
 Prevention/Avoidance
 Detection/Correction
 Ignorance
8/13/2017
9
DEADLOCK PREVENTION
 Restrain the ways request can be made.
 Mutual Exclusion – not required for sharable resources;
must hold for non-sharable resources.
 Hold and Wait – must guarantee that whenever a process
requests a resource, it does not hold any other resources.
 No Preemption –
 Circular Wait –
8/13/2017
10
DEADLOCK AVOIDANCE
 Requires additional information about how resources are to
be used.
 The deadlock-avoidance algorithm dynamically examines
the resource-allocation state to ensure that there can never
be a circular-wait condition.
 Resource-allocation state is defined by the number of
available and allocated resources, and the maximum
demands of the processes.
8/13/2017
11
SAFE, UNSAFE DEADLOCK STATE
8/13/2017
12
SAFE & UNSAFE STATE - Example
8/13/2017
13
3
DEADLOCK AVOIDANCE ALGORITHM
 Single instance of a resource type.
Use a resource-allocation graph
Cycles are necessary are sufficient for deadlock
 Multiple instances of a resource type.
Use the banker’s algorithm
Cycles are necessary, but not sufficient for deadlock
8/13/2017
14
RESOURCE ALLOCATION GRAPHALGORITHM
 Claim edge Pi  Rj indicates that process Pj may request resource
Rj; represented by a dashed line.
 Claim edge converts to request edge when a process requests a
resource.
 Request edge converted to an assignment edge when the
resource is allocated to the process.
 When a resource is released by a process, assignment edge
reconverts to a claim edge.
 Resources must be claimed a priori in the system.
8/13/2017
15
BANKER’S ALGORITHM
 RAG is not applicable for multiple instance of resource
 Bankers’ algorithm - Multiple instances.
 Each process claims maximum resource needs a priori.
 When a process requests a resource it may have to wait.
 When a process gets all of its resources it must return them
in a finite amount of time.
8/13/2017
16
8/13/2017
17

More Related Content

Similar to Dead Lock

Chapter 8 Operating Systems silberschatz : deadlocks
Chapter 8 Operating Systems silberschatz : deadlocksChapter 8 Operating Systems silberschatz : deadlocks
Chapter 8 Operating Systems silberschatz : deadlocks
GiulianoRanauro
 
Deadlocks final
Deadlocks finalDeadlocks final
Deadlocks final
marangburu42
 
Deadlock in DBMS
Deadlock in DBMSDeadlock in DBMS
Deadlock in DBMS
ijtsrd
 
Deadlock in DBMS
Deadlock in DBMSDeadlock in DBMS
Deadlock in DBMS
ijtsrd
 
Deadlock in DBMS
Deadlock in DBMSDeadlock in DBMS
Deadlock in DBMS
ijtsrd
 
Sucet os module_3_notes
Sucet os module_3_notesSucet os module_3_notes
Sucet os module_3_notes
SRINIVASUNIVERSITYEN
 
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
Rai University
 
Lecture # 10-11 for deadlock operating system.ppt
Lecture # 10-11 for deadlock operating system.pptLecture # 10-11 for deadlock operating system.ppt
Lecture # 10-11 for deadlock operating system.ppt
RiaanSadiq
 
Ch8: Deadlocks
Ch8: DeadlocksCh8: Deadlocks
Ch8: Deadlocks
Ahmar Hashmi
 
ch7.ppt
ch7.pptch7.ppt
ch7.ppt
DrMajidMumtaz
 
ch7.ppt
ch7.pptch7.ppt
ch7.ppt
Sami Mughal
 
MPMC chapter
MPMC chapterMPMC chapter
MPMC chapter
subhamsriramka
 
Galvin Operating Systems of deadlock.ppt
Galvin Operating Systems of deadlock.pptGalvin Operating Systems of deadlock.ppt
Galvin Operating Systems of deadlock.ppt
ranjithasr8
 
Os module 2 d
Os module 2 dOs module 2 d
Os module 2 d
Gichelle Amon
 
Deadlocks prefinal
Deadlocks prefinalDeadlocks prefinal
Deadlocks prefinal
marangburu42
 
Deadlocksprefinal 161014115456
Deadlocksprefinal 161014115456Deadlocksprefinal 161014115456
Deadlocksprefinal 161014115456
marangburu42
 
Module3
Module3Module3
Module3
dilshad begum
 
Deadlocks 160928121516-160928183232
Deadlocks 160928121516-160928183232Deadlocks 160928121516-160928183232
Deadlocks 160928121516-160928183232
marangburu42
 
Dead Lock
Dead LockDead Lock
Dead Lock
Ramasubbu .P
 
Ch8
Ch8Ch8

Similar to Dead Lock (20)

Chapter 8 Operating Systems silberschatz : deadlocks
Chapter 8 Operating Systems silberschatz : deadlocksChapter 8 Operating Systems silberschatz : deadlocks
Chapter 8 Operating Systems silberschatz : deadlocks
 
Deadlocks final
Deadlocks finalDeadlocks final
Deadlocks final
 
Deadlock in DBMS
Deadlock in DBMSDeadlock in DBMS
Deadlock in DBMS
 
Deadlock in DBMS
Deadlock in DBMSDeadlock in DBMS
Deadlock in DBMS
 
Deadlock in DBMS
Deadlock in DBMSDeadlock in DBMS
Deadlock in DBMS
 
Sucet os module_3_notes
Sucet os module_3_notesSucet os module_3_notes
Sucet os module_3_notes
 
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
 
Lecture # 10-11 for deadlock operating system.ppt
Lecture # 10-11 for deadlock operating system.pptLecture # 10-11 for deadlock operating system.ppt
Lecture # 10-11 for deadlock operating system.ppt
 
Ch8: Deadlocks
Ch8: DeadlocksCh8: Deadlocks
Ch8: Deadlocks
 
ch7.ppt
ch7.pptch7.ppt
ch7.ppt
 
ch7.ppt
ch7.pptch7.ppt
ch7.ppt
 
MPMC chapter
MPMC chapterMPMC chapter
MPMC chapter
 
Galvin Operating Systems of deadlock.ppt
Galvin Operating Systems of deadlock.pptGalvin Operating Systems of deadlock.ppt
Galvin Operating Systems of deadlock.ppt
 
Os module 2 d
Os module 2 dOs module 2 d
Os module 2 d
 
Deadlocks prefinal
Deadlocks prefinalDeadlocks prefinal
Deadlocks prefinal
 
Deadlocksprefinal 161014115456
Deadlocksprefinal 161014115456Deadlocksprefinal 161014115456
Deadlocksprefinal 161014115456
 
Module3
Module3Module3
Module3
 
Deadlocks 160928121516-160928183232
Deadlocks 160928121516-160928183232Deadlocks 160928121516-160928183232
Deadlocks 160928121516-160928183232
 
Dead Lock
Dead LockDead Lock
Dead Lock
 
Ch8
Ch8Ch8
Ch8
 

More from Sohag Babu

Twisted pair cable
Twisted pair cableTwisted pair cable
Twisted pair cable
Sohag Babu
 
Software testing lifecycle
Software testing lifecycleSoftware testing lifecycle
Software testing lifecycle
Sohag Babu
 
Social networking
Social networkingSocial networking
Social networking
Sohag Babu
 
Simple web browser
Simple web browserSimple web browser
Simple web browser
Sohag Babu
 
Regression analysis
Regression analysisRegression analysis
Regression analysis
Sohag Babu
 
Presentation of transistor
Presentation of transistorPresentation of transistor
Presentation of transistor
Sohag Babu
 
Normalization & join
Normalization & joinNormalization & join
Normalization & join
Sohag Babu
 
E learning
E learningE learning
E learning
Sohag Babu
 
Applications of differential equations
Applications of differential equationsApplications of differential equations
Applications of differential equations
Sohag Babu
 
Application of numerical methods
Application of numerical methodsApplication of numerical methods
Application of numerical methods
Sohag Babu
 
Application layer
Application layerApplication layer
Application layer
Sohag Babu
 
4th generation computer
4th generation computer4th generation computer
4th generation computer
Sohag Babu
 

More from Sohag Babu (12)

Twisted pair cable
Twisted pair cableTwisted pair cable
Twisted pair cable
 
Software testing lifecycle
Software testing lifecycleSoftware testing lifecycle
Software testing lifecycle
 
Social networking
Social networkingSocial networking
Social networking
 
Simple web browser
Simple web browserSimple web browser
Simple web browser
 
Regression analysis
Regression analysisRegression analysis
Regression analysis
 
Presentation of transistor
Presentation of transistorPresentation of transistor
Presentation of transistor
 
Normalization & join
Normalization & joinNormalization & join
Normalization & join
 
E learning
E learningE learning
E learning
 
Applications of differential equations
Applications of differential equationsApplications of differential equations
Applications of differential equations
 
Application of numerical methods
Application of numerical methodsApplication of numerical methods
Application of numerical methods
 
Application layer
Application layerApplication layer
Application layer
 
4th generation computer
4th generation computer4th generation computer
4th generation computer
 

Recently uploaded

Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
nooriasukmaningtyas
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
jpsjournal1
 
Casting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdfCasting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdf
zubairahmad848137
 
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
 
Engine Lubrication performance System.pdf
Engine Lubrication performance System.pdfEngine Lubrication performance System.pdf
Engine Lubrication performance System.pdf
mamamaam477
 
CSM Cloud Service Management Presentarion
CSM Cloud Service Management PresentarionCSM Cloud Service Management Presentarion
CSM Cloud Service Management Presentarion
rpskprasana
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
camseq
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
mamunhossenbd75
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
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
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
RadiNasr
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
KrishnaveniKrishnara1
 
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
 
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
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
gerogepatton
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
KrishnaveniKrishnara1
 
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
IJNSA Journal
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
171ticu
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
co23btech11018
 

Recently uploaded (20)

Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
 
Casting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdfCasting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdf
 
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
 
Engine Lubrication performance System.pdf
Engine Lubrication performance System.pdfEngine Lubrication performance System.pdf
Engine Lubrication performance System.pdf
 
CSM Cloud Service Management Presentarion
CSM Cloud Service Management PresentarionCSM Cloud Service Management Presentarion
CSM Cloud Service Management Presentarion
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
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
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
 
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
 
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
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
 
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
 

Dead Lock

  • 2. Presented by: Md. Sohag Em@il : sohag.0315@gmail.com Presented to: Deadlock 2 8/13/2017
  • 3. What is Deadlock ?  A set of blocked processes each holding a resource and waiting to acquire a resource held by another process in the set.  Example 2 train approaches each other at crossing, both will come to full stop and neither shall start until other has gone. 8/13/2017 3
  • 4. Deadlock Example  Traffic only in one direction.  Each section of a bridge can be viewed as a resource.  If a deadlock occurs, it can be resolved if one car backs up .  Several cars may have to be backed up if a deadlock occurs. 8/13/2017 4
  • 5. DEADLOCK CHARACTERIZATION  Deadlock can arise if four conditions hold simultaneously.  Mutual exclusion  Hold and wait  No preemption  Circular wait 8/13/2017 5
  • 6. RESOURCE-ALLOCATION GRAPH  Deadlocks can be described in term of directed graph- SYSTEM RESOURCE- ALLOCATION GRAPH.  Process  Resource Type with 4 instances  Pi requests instance of Rj  Pi is holding an instance of Rj p Pi Rj Pi Rj 8/13/2017 6
  • 7. EXAMPLE OF RESOURCE-ALLOCATION GRAPH 8/13/2017 7 p3 p1 p2 R2 R1 R3 R4
  • 8. RESOURCE-ALLOCATIONGRAPH AND A DEADLOCK 8/13/2017 8
  • 9. METHODS FOR HANDLINGDEADLOCK  We can deal with DL problem in 3-ways:  Prevention/Avoidance  Detection/Correction  Ignorance 8/13/2017 9
  • 10. DEADLOCK PREVENTION  Restrain the ways request can be made.  Mutual Exclusion – not required for sharable resources; must hold for non-sharable resources.  Hold and Wait – must guarantee that whenever a process requests a resource, it does not hold any other resources.  No Preemption –  Circular Wait – 8/13/2017 10
  • 11. DEADLOCK AVOIDANCE  Requires additional information about how resources are to be used.  The deadlock-avoidance algorithm dynamically examines the resource-allocation state to ensure that there can never be a circular-wait condition.  Resource-allocation state is defined by the number of available and allocated resources, and the maximum demands of the processes. 8/13/2017 11
  • 12. SAFE, UNSAFE DEADLOCK STATE 8/13/2017 12
  • 13. SAFE & UNSAFE STATE - Example 8/13/2017 13 3
  • 14. DEADLOCK AVOIDANCE ALGORITHM  Single instance of a resource type. Use a resource-allocation graph Cycles are necessary are sufficient for deadlock  Multiple instances of a resource type. Use the banker’s algorithm Cycles are necessary, but not sufficient for deadlock 8/13/2017 14
  • 15. RESOURCE ALLOCATION GRAPHALGORITHM  Claim edge Pi  Rj indicates that process Pj may request resource Rj; represented by a dashed line.  Claim edge converts to request edge when a process requests a resource.  Request edge converted to an assignment edge when the resource is allocated to the process.  When a resource is released by a process, assignment edge reconverts to a claim edge.  Resources must be claimed a priori in the system. 8/13/2017 15
  • 16. BANKER’S ALGORITHM  RAG is not applicable for multiple instance of resource  Bankers’ algorithm - Multiple instances.  Each process claims maximum resource needs a priori.  When a process requests a resource it may have to wait.  When a process gets all of its resources it must return them in a finite amount of time. 8/13/2017 16