SlideShare a Scribd company logo
1 of 22
DISTRIBUTED DEADLOCK
DETECTION
BY
Dr. T.R.SRINIVASAN, B.E., M.E., Ph.D.,
Assistant Professor,
School of Electrical and Computer Engineering,
Jimma Institute of Technology,
Jimma University,
Jimma
1
THE SYSTEM MODEL
• In chapter 1:
– Deadlock under centralized system
– Methods to handle deadlock
• Deadlock in DS under following model
– System have only reusable resources
– Process are allowed only exclusive access to resources
– Only one copy of resources
• States of Process
– Running
– Blocked
• Deadlock
– Resource Deadlock
– Communication Deadlock
• Resource Allocation Graph
• Wait-For Graph(WFG)
• Transaction-Wait-For Graph(TWF Graph)
2
DEADLOCK HANDLING STRATEGIES IN
DISTRIBUTED SYSTEM (DS)
• DEADLOCK PREVENTION
– Process acquire needed resources before execution
• Inefficient as it decreases system concurrency
• Set of process can become deadlocked while resource acquiring
• Future resource requirements are unpredictable
– Preempting a process that holds needed resource
• DEADLOCK AVOIDANCE
– Resource is granted if the resulting global state is safe
• Every site to maintain global state of the system – huge storage requirement and
communication cost
• Process of checking the global state must be mutually exclusive – several site concurrently
checks for safe global state but the net global state may not be true
• Large No. of Processes and Resources – Computationally Expensive
• DEADLOCK DETECTION
– Once cycle is formed in WFG – it persists until detected and broken
– Cycle detection can proceed concurrently with the normal activity
3
ISSUES IN DEADLOCK DETECTION AND RESOLUTION
• Detection of Existing Deadlocks
– In DS, cycle involves several sites – search for cycle depends how WFG is
represented
• Centralized Algorithms
• Distributed Algorithms
• Hierarchical Algorithms
– Correct deadlock Detection Algorithm must satisfy
• Progress – No Undetected Deadlocks
– Detect all deadlocks in finite time
– After all wait-for dependencies are formed – algorithm should not wait for more to
detect the deadlock
• Safety – No False Deadlocks
– Not report deadlocks that are non-existent (PHANTOM DEADLOCKS)
• Resolution of detected Deadlocks
– Breaking wait-for dependencies to resolve deadlocks
– Rolling back one or more processes that are deadlocked
– Algorithms propagate regarding wait-for along the edges
• When edge is broken, it should be updated to all sites
• Not updated in time will result in Phantom Deadlocks 4
CONTROL ORGANIZATIONS FOR DDD
• CETRALIZED CONTROL
– Control site responsible for constructing the WFG
– Searches for cycles
– Maintains WFG or built it whenever DD to be carried out
– Simple and easy to implement
– Single point of failure
– Congested near the control site because of msgs from all other sites
• DISTRIBUTED CONTROL
– Responsibility is shared equally among all sites
– Global state graph is spread over many sites
– Several site participate I detecting deadlock
– Detection is initiated by a waiting process suspected to be part of a cycle
– difficult to design due to lack of globally shared memory
– Several sites may initiate detection for the same deadlock
– Proof of correctness is difficult for these algorithms
– Resolution is cumbersome – several sites detect same deadlock and not aware of other sites involved
• HIERARCHICAL CONTROL
– Sites are arranged in hierarchical fashion
– Sites detects deadlock involving only its descendant sites
– Get the best of both CETRALIZED and DISTRIBUTED CONTROL
– Requires special care while arranging the sites in hierarchical order
– Objective is defeated if deadlocks span several clusters
5
CENTRALIZED DEADLOCK DETECTION ALGORITHMS
• THE COMPLETELY CENTRALIZED ALGORITHM
– Simplest Centralized Deadlock Detection Algorithm
– Control Site(CS) maintain WFG
– Msgs to control site by all other sites
• Request resource
• Release resource
– Control site receives msg updates WFG
– Whenever adds edge to WFG checks for deadlocks
– Simple and easy to implement
– Inefficient since all request will be thru CS even for a local resource
– Large delays, communication and congestion overheads
– Reliability is poor – control site failure
– Solution for above issues
• Local WFG maintained by each site and sends to CS whenever global WFG is constructed
• But due to comm. Delay and inconsistent view of the system detects false deadlocks
• Example – Resource R1 and R2 at site S1 and S2, Transaction T1 and T2 started simultaneously at site S3 and S4.
– T1 T2
Lock R1 Lock R1
Unlock R1 unlock R1
Lock R2 Lock R2
Unlock R2 unlock R2
• THE HO-RAMAMOORTHY ALGORITHMS
– Two-phase Algorithm
– One-phase Algorithm 6
Cont…
• Two-phase Algorithm
– Each site maintains a status table – contains status of processes
of that site
– Status of process – resources locked and resources being
waited for
– Periodically, control site requests for status table from all other
sites and constructs WFG and searches for deadlocks
– If no cycles, system is free from deadlock
– Otherwise, control site ask for status table again
– Constructs WFG with transactions common to both reports
• By selecting the common transaction gets the consistent view of the
system
• In deadlock, same wait-for condition must exist in both report
• May result in false deadlock reports
• By getting two reports, reduces the probability of getting an
inconsistent view, but does not eliminate the possibility 7
• One-phase Algorithm
– Requires only one status report from each site
– Each site maintains two tables
• Resource status table
– Transactions that locked or waiting for resources of that site
• Process status table
– Resources locked and being waited by processes
– Periodically, control site requests for both tables from
all sites and constructs WFG using transactions
common to both tables
– Now searches the WFG for cycles
– Consistent and faster when compared with two-phase
– Requires fewer msgs than two-phase
– Requires more storage since maintains two tables
– Msg size is bigger since transfers both tables 8
Cont…
• All sites collectively cooperate to detect
deadlock
• Initiated when a process is forced to wait
• Initiated by the site where the process waits
or by the local site
• Classes of algorithm
– Path-pushing
– Edge-chasing
– Diffusion computation
– Global state detection
9
DISTRIBUTED DEADLOCK DETECTION ALGORITHMS
• Information about wait-for dependencies is propagated as paths
• Obermarch’s algorithm is used to demonstrate which uses
distributed database system
• Process are referred to transactions denoted by T1,T2,T3,…,Tn
• Transactions have multiple subtransactions that executes in
different sites
• Atmost one subtransaction within a transaction can be executing at
the same time
• Execution passes sequentially from one to the other
• Subtransactions communicate using msgs
• Algorithm features
– Nonlocal portion of WFG is abstracted(realeted) by a node(External or
Ex)
– Transactions are ordered which reduces the msgs and reduces
deadlock detection overheads
– Ensures exactly one transaction in each cycle detects deadlock
10
A PATH-PUSHING ALGORITHM
11
• Uses a special message called PROBE
• Probe is triplet(I,j,k)
– Deadlock detection initiated for process Pi
– Sent by home site of Pj
– To the home site of Pk
• Probe travels along the edges of TWF graph
• Deadlock detected when returns to initiaing process
• Terms and data structures used in this algorithm
– Pj is said to depend on Pk if exists a sequence like Pj,Pi1,Pi2,Pi3,…,Pim,Pk
– Each process is blocked except Pk
– All process holds a resource for which the previous process is waiting
except Pj
– System maintains a boolean array: Dependenti
– Dependenti (j) is true, if Pi knows Pj is dependent on it
– Initially Dependenti(j) is false for all i and j
12
AN EDGE-CHASING ALGORITHM
13
14
• Deadlock detection computation is diffused through WFG
• Msgs used: query(i,j,k) and reply(i,j,k)
– Diffusion computation initiated by Pi , Sent from Pj , Sent to Pk
• Blocked process sends the query msg to all processes
• Active process discards both query and reply msg
• When a blocked process receives a query, it takes the following
action
– If first query msg(called engaging query) by Pk, then propagates to all
dependents, sets NUMk(i) to the no. of query messages sent
– Not an engaging query, Pk returns a reply msg immediately, provided Pk is
blocked else discards it
– Local boolean variablenWAITk(i) at Pk denotes it’s blocked since the
engaging msg from Pi
– When blocked process receives a reply msg decrements NUMk(i) and holds
WAITk(i)
15
A DIFFUSION COMPUTATION BASED ALGORITHM
16
• Three Algorithms
• Bracha and Toueg Algorithm
– Two Phases
• First Phase: Records the snapshot of WFG
• Second Phase: simulates the request grand for deadlocks
• Second phase is nested inside first phase
• Wang Algorithm
– Two Phases
• First Phase: Records the snapshot of WFG
• Second Phase: WFG recorded is reduced to detect deadlocks
• first phase and Second phase occur serially
• Kshemkalyani-Singhal Algorithm
– Single Phase and Both sweeps are done concurrently
– Fan-out sweep msgs outward from the initiator process
– Fan-in sweep msgs inward to the initiator process
– Sweep of WFG is a traversal of the WFG
– Fan-out: msg will traverse along the edges in edge direction
– Fan-in: msg will traverse along the edges in opposite edge direction
– In the inward sweep, recorded WFG is reduced to determine whether initiator is deadlocked
or not 17
A GLOBAL STATE DETECTION BASED ALGORITHM
18
SYSTEM MODEL
1. System has N nodes
2. Nodes connected to other by a logical channel
3. Event in a computation – Internal, msg sent, msg receive
4. Events are assigned timestamp as per Lamport’s clock
5. Event occurred at time t on node i is given by ti
6. Computation msg can be REQUEST, REPLY or CANCEL
7. A node sends REQUEST to other nodes when it blocks
8. when node I blocks on node j, node j becomes successor of node i in WFG
9. A reply msg denotes the granting of request
10. A node i unblocks when Pi out of its Qi request are granted
11. When node unblocks, sends CANCEL msg to withdraw the remaining requests it had sent
19
• Sites are arranged in Hierarchical fashion
• Site is responsible for detecting deadlocks involving only its
children sites
• Localized to a cluster of sites
• Two different algorithms
– The Menasce-Muntz Algorithm
• Controllers are arranged in tree fashion
• Controllers manage resources and detects deadlocks
• Controllers at the bottom most(leaf controllers) manages the resources
• Non leaf controllers are responsible for deadlock detection
• A leaf controller maintains part of global WFG concerned with the resources
allocated by it
• A non leaf controller maintains all TWF graph spanning its children and
responsible for detecting deadlocks involving all its children
• If change occurs in TWF due to allocation, wait or release – it propagates to its
parent controller
• Parent controller updates TWF and checks for cycles, propagates up if necessary
20
HIERARCHICAL DEADLOCK DETECTION ALGORITHMS
The Ho-Ramamoorthy Algorithm
• Sites are grouped into several disjoint clusters
• A site is chosen as central control site, which
dynamically chooses control site for clusters
• Central CS requests each cluster CS for transaction
status and wait-for relations
• Central CS after collecting status table from all
clusters applies one-phase deadlock detection
algorithm for intracluster deadlocks
• Central CS send intercluster information to cluster CS
• Cluster CS splices the information constructs the WFG
and checks for cycles
21
Cont…
22

More Related Content

Similar to ch 2 - DISTRIBUTED DEADLOCK DETECTION.pptx

Checkpointing.pptx
Checkpointing.pptxCheckpointing.pptx
Checkpointing.pptxAzmiNizar1
 
UNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptxUNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptxansariparveen06
 
Inter process communication
Inter process communicationInter process communication
Inter process communicationGift Kaliza
 
Kcd226 Sistem Operasi Lecture05
Kcd226 Sistem Operasi Lecture05Kcd226 Sistem Operasi Lecture05
Kcd226 Sistem Operasi Lecture05Cahyo Darujati
 
deadlock and starvation resources allocation.pptx
deadlock and starvation resources allocation.pptxdeadlock and starvation resources allocation.pptx
deadlock and starvation resources allocation.pptxSaba651353
 
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 SystemsDr Sandeep Kumar Poonia
 
Performance Enhancement with Pipelining
Performance Enhancement with PipeliningPerformance Enhancement with Pipelining
Performance Enhancement with PipeliningAneesh Raveendran
 
Real-time Change Detection & Automatic Network Response
Real-time Change Detection & Automatic Network ResponseReal-time Change Detection & Automatic Network Response
Real-time Change Detection & Automatic Network ResponseMike Fisk
 
Synchronization
SynchronizationSynchronization
SynchronizationSara shall
 
Operating System Notes (1).pdf
Operating System Notes (1).pdfOperating System Notes (1).pdf
Operating System Notes (1).pdfshriyashpatil7
 
Operating System Notes help for interview pripration
Operating System Notes  help for interview priprationOperating System Notes  help for interview pripration
Operating System Notes help for interview priprationajaybiradar99999
 
Operating System Notes.pdf
Operating System Notes.pdfOperating System Notes.pdf
Operating System Notes.pdfAminaArshad42
 
Multiprocessing -Interprocessing communication and process sunchronization,se...
Multiprocessing -Interprocessing communication and process sunchronization,se...Multiprocessing -Interprocessing communication and process sunchronization,se...
Multiprocessing -Interprocessing communication and process sunchronization,se...Neena R Krishna
 
MariaDB High Availability Webinar
MariaDB High Availability WebinarMariaDB High Availability Webinar
MariaDB High Availability WebinarMariaDB plc
 
3 (1) [Autosaved].ppt
3 (1) [Autosaved].ppt3 (1) [Autosaved].ppt
3 (1) [Autosaved].pptamadayshwan
 

Similar to ch 2 - DISTRIBUTED DEADLOCK DETECTION.pptx (20)

Checkpointing.pptx
Checkpointing.pptxCheckpointing.pptx
Checkpointing.pptx
 
UNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptxUNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptx
 
Inter process communication
Inter process communicationInter process communication
Inter process communication
 
Kcd226 Sistem Operasi Lecture05
Kcd226 Sistem Operasi Lecture05Kcd226 Sistem Operasi Lecture05
Kcd226 Sistem Operasi Lecture05
 
Lect07
Lect07Lect07
Lect07
 
deadlock and starvation resources allocation.pptx
deadlock and starvation resources allocation.pptxdeadlock and starvation resources allocation.pptx
deadlock and starvation resources allocation.pptx
 
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
 
Performance Enhancement with Pipelining
Performance Enhancement with PipeliningPerformance Enhancement with Pipelining
Performance Enhancement with Pipelining
 
deadlock.ppt
deadlock.pptdeadlock.ppt
deadlock.ppt
 
Real-time Change Detection & Automatic Network Response
Real-time Change Detection & Automatic Network ResponseReal-time Change Detection & Automatic Network Response
Real-time Change Detection & Automatic Network Response
 
Synchronization
SynchronizationSynchronization
Synchronization
 
CHAP4.pptx
CHAP4.pptxCHAP4.pptx
CHAP4.pptx
 
Distributed DBMS - Unit 9 - Distributed Deadlock & Recovery
Distributed DBMS - Unit 9 - Distributed Deadlock & RecoveryDistributed DBMS - Unit 9 - Distributed Deadlock & Recovery
Distributed DBMS - Unit 9 - Distributed Deadlock & Recovery
 
Operating System Notes (1).pdf
Operating System Notes (1).pdfOperating System Notes (1).pdf
Operating System Notes (1).pdf
 
Operating System Notes help for interview pripration
Operating System Notes  help for interview priprationOperating System Notes  help for interview pripration
Operating System Notes help for interview pripration
 
Operating System Notes.pdf
Operating System Notes.pdfOperating System Notes.pdf
Operating System Notes.pdf
 
Multiprocessing -Interprocessing communication and process sunchronization,se...
Multiprocessing -Interprocessing communication and process sunchronization,se...Multiprocessing -Interprocessing communication and process sunchronization,se...
Multiprocessing -Interprocessing communication and process sunchronization,se...
 
MariaDB High Availability Webinar
MariaDB High Availability WebinarMariaDB High Availability Webinar
MariaDB High Availability Webinar
 
3 (1) [Autosaved].ppt
3 (1) [Autosaved].ppt3 (1) [Autosaved].ppt
3 (1) [Autosaved].ppt
 
OS-Part-06.pdf
OS-Part-06.pdfOS-Part-06.pdf
OS-Part-06.pdf
 

More from Ethiopia Satlliet television

More from Ethiopia Satlliet television (11)

gabasaa sadarkaa hojjiin irra jirruu.docx
gabasaa sadarkaa hojjiin irra jirruu.docxgabasaa sadarkaa hojjiin irra jirruu.docx
gabasaa sadarkaa hojjiin irra jirruu.docx
 
What is computer engineering?fffffffffffffgfff
What is computer engineering?fffffffffffffgfffWhat is computer engineering?fffffffffffffgfff
What is computer engineering?fffffffffffffgfff
 
relational management computer engineering
relational management computer  engineeringrelational management computer  engineering
relational management computer engineering
 
File System operating system operating system
File System  operating system operating systemFile System  operating system operating system
File System operating system operating system
 
Chapter - 1 Introduction to networking (3).ppt
Chapter - 1 Introduction to networking (3).pptChapter - 1 Introduction to networking (3).ppt
Chapter - 1 Introduction to networking (3).ppt
 
E-service-Application-For-Online-Research-Proposal-Guidance.pdf
E-service-Application-For-Online-Research-Proposal-Guidance.pdfE-service-Application-For-Online-Research-Proposal-Guidance.pdf
E-service-Application-For-Online-Research-Proposal-Guidance.pdf
 
Requirements of DBMS for balaqqee departments.docx
Requirements of DBMS for balaqqee departments.docxRequirements of DBMS for balaqqee departments.docx
Requirements of DBMS for balaqqee departments.docx
 
cover letter.docx kebede teshite guye shuka
cover letter.docx kebede teshite guye shukacover letter.docx kebede teshite guye shuka
cover letter.docx kebede teshite guye shuka
 
git tutorial for beginner all aboutaaaaa
git tutorial for beginner all aboutaaaaagit tutorial for beginner all aboutaaaaa
git tutorial for beginner all aboutaaaaa
 
Buzunesh Daargee.docx
Buzunesh Daargee.docxBuzunesh Daargee.docx
Buzunesh Daargee.docx
 
Kabe doc (2).docx
Kabe doc (2).docxKabe doc (2).docx
Kabe doc (2).docx
 

Recently uploaded

The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 

Recently uploaded (20)

The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 

ch 2 - DISTRIBUTED DEADLOCK DETECTION.pptx

  • 1. DISTRIBUTED DEADLOCK DETECTION BY Dr. T.R.SRINIVASAN, B.E., M.E., Ph.D., Assistant Professor, School of Electrical and Computer Engineering, Jimma Institute of Technology, Jimma University, Jimma 1
  • 2. THE SYSTEM MODEL • In chapter 1: – Deadlock under centralized system – Methods to handle deadlock • Deadlock in DS under following model – System have only reusable resources – Process are allowed only exclusive access to resources – Only one copy of resources • States of Process – Running – Blocked • Deadlock – Resource Deadlock – Communication Deadlock • Resource Allocation Graph • Wait-For Graph(WFG) • Transaction-Wait-For Graph(TWF Graph) 2
  • 3. DEADLOCK HANDLING STRATEGIES IN DISTRIBUTED SYSTEM (DS) • DEADLOCK PREVENTION – Process acquire needed resources before execution • Inefficient as it decreases system concurrency • Set of process can become deadlocked while resource acquiring • Future resource requirements are unpredictable – Preempting a process that holds needed resource • DEADLOCK AVOIDANCE – Resource is granted if the resulting global state is safe • Every site to maintain global state of the system – huge storage requirement and communication cost • Process of checking the global state must be mutually exclusive – several site concurrently checks for safe global state but the net global state may not be true • Large No. of Processes and Resources – Computationally Expensive • DEADLOCK DETECTION – Once cycle is formed in WFG – it persists until detected and broken – Cycle detection can proceed concurrently with the normal activity 3
  • 4. ISSUES IN DEADLOCK DETECTION AND RESOLUTION • Detection of Existing Deadlocks – In DS, cycle involves several sites – search for cycle depends how WFG is represented • Centralized Algorithms • Distributed Algorithms • Hierarchical Algorithms – Correct deadlock Detection Algorithm must satisfy • Progress – No Undetected Deadlocks – Detect all deadlocks in finite time – After all wait-for dependencies are formed – algorithm should not wait for more to detect the deadlock • Safety – No False Deadlocks – Not report deadlocks that are non-existent (PHANTOM DEADLOCKS) • Resolution of detected Deadlocks – Breaking wait-for dependencies to resolve deadlocks – Rolling back one or more processes that are deadlocked – Algorithms propagate regarding wait-for along the edges • When edge is broken, it should be updated to all sites • Not updated in time will result in Phantom Deadlocks 4
  • 5. CONTROL ORGANIZATIONS FOR DDD • CETRALIZED CONTROL – Control site responsible for constructing the WFG – Searches for cycles – Maintains WFG or built it whenever DD to be carried out – Simple and easy to implement – Single point of failure – Congested near the control site because of msgs from all other sites • DISTRIBUTED CONTROL – Responsibility is shared equally among all sites – Global state graph is spread over many sites – Several site participate I detecting deadlock – Detection is initiated by a waiting process suspected to be part of a cycle – difficult to design due to lack of globally shared memory – Several sites may initiate detection for the same deadlock – Proof of correctness is difficult for these algorithms – Resolution is cumbersome – several sites detect same deadlock and not aware of other sites involved • HIERARCHICAL CONTROL – Sites are arranged in hierarchical fashion – Sites detects deadlock involving only its descendant sites – Get the best of both CETRALIZED and DISTRIBUTED CONTROL – Requires special care while arranging the sites in hierarchical order – Objective is defeated if deadlocks span several clusters 5
  • 6. CENTRALIZED DEADLOCK DETECTION ALGORITHMS • THE COMPLETELY CENTRALIZED ALGORITHM – Simplest Centralized Deadlock Detection Algorithm – Control Site(CS) maintain WFG – Msgs to control site by all other sites • Request resource • Release resource – Control site receives msg updates WFG – Whenever adds edge to WFG checks for deadlocks – Simple and easy to implement – Inefficient since all request will be thru CS even for a local resource – Large delays, communication and congestion overheads – Reliability is poor – control site failure – Solution for above issues • Local WFG maintained by each site and sends to CS whenever global WFG is constructed • But due to comm. Delay and inconsistent view of the system detects false deadlocks • Example – Resource R1 and R2 at site S1 and S2, Transaction T1 and T2 started simultaneously at site S3 and S4. – T1 T2 Lock R1 Lock R1 Unlock R1 unlock R1 Lock R2 Lock R2 Unlock R2 unlock R2 • THE HO-RAMAMOORTHY ALGORITHMS – Two-phase Algorithm – One-phase Algorithm 6
  • 7. Cont… • Two-phase Algorithm – Each site maintains a status table – contains status of processes of that site – Status of process – resources locked and resources being waited for – Periodically, control site requests for status table from all other sites and constructs WFG and searches for deadlocks – If no cycles, system is free from deadlock – Otherwise, control site ask for status table again – Constructs WFG with transactions common to both reports • By selecting the common transaction gets the consistent view of the system • In deadlock, same wait-for condition must exist in both report • May result in false deadlock reports • By getting two reports, reduces the probability of getting an inconsistent view, but does not eliminate the possibility 7
  • 8. • One-phase Algorithm – Requires only one status report from each site – Each site maintains two tables • Resource status table – Transactions that locked or waiting for resources of that site • Process status table – Resources locked and being waited by processes – Periodically, control site requests for both tables from all sites and constructs WFG using transactions common to both tables – Now searches the WFG for cycles – Consistent and faster when compared with two-phase – Requires fewer msgs than two-phase – Requires more storage since maintains two tables – Msg size is bigger since transfers both tables 8 Cont…
  • 9. • All sites collectively cooperate to detect deadlock • Initiated when a process is forced to wait • Initiated by the site where the process waits or by the local site • Classes of algorithm – Path-pushing – Edge-chasing – Diffusion computation – Global state detection 9 DISTRIBUTED DEADLOCK DETECTION ALGORITHMS
  • 10. • Information about wait-for dependencies is propagated as paths • Obermarch’s algorithm is used to demonstrate which uses distributed database system • Process are referred to transactions denoted by T1,T2,T3,…,Tn • Transactions have multiple subtransactions that executes in different sites • Atmost one subtransaction within a transaction can be executing at the same time • Execution passes sequentially from one to the other • Subtransactions communicate using msgs • Algorithm features – Nonlocal portion of WFG is abstracted(realeted) by a node(External or Ex) – Transactions are ordered which reduces the msgs and reduces deadlock detection overheads – Ensures exactly one transaction in each cycle detects deadlock 10 A PATH-PUSHING ALGORITHM
  • 11. 11
  • 12. • Uses a special message called PROBE • Probe is triplet(I,j,k) – Deadlock detection initiated for process Pi – Sent by home site of Pj – To the home site of Pk • Probe travels along the edges of TWF graph • Deadlock detected when returns to initiaing process • Terms and data structures used in this algorithm – Pj is said to depend on Pk if exists a sequence like Pj,Pi1,Pi2,Pi3,…,Pim,Pk – Each process is blocked except Pk – All process holds a resource for which the previous process is waiting except Pj – System maintains a boolean array: Dependenti – Dependenti (j) is true, if Pi knows Pj is dependent on it – Initially Dependenti(j) is false for all i and j 12 AN EDGE-CHASING ALGORITHM
  • 13. 13
  • 14. 14
  • 15. • Deadlock detection computation is diffused through WFG • Msgs used: query(i,j,k) and reply(i,j,k) – Diffusion computation initiated by Pi , Sent from Pj , Sent to Pk • Blocked process sends the query msg to all processes • Active process discards both query and reply msg • When a blocked process receives a query, it takes the following action – If first query msg(called engaging query) by Pk, then propagates to all dependents, sets NUMk(i) to the no. of query messages sent – Not an engaging query, Pk returns a reply msg immediately, provided Pk is blocked else discards it – Local boolean variablenWAITk(i) at Pk denotes it’s blocked since the engaging msg from Pi – When blocked process receives a reply msg decrements NUMk(i) and holds WAITk(i) 15 A DIFFUSION COMPUTATION BASED ALGORITHM
  • 16. 16
  • 17. • Three Algorithms • Bracha and Toueg Algorithm – Two Phases • First Phase: Records the snapshot of WFG • Second Phase: simulates the request grand for deadlocks • Second phase is nested inside first phase • Wang Algorithm – Two Phases • First Phase: Records the snapshot of WFG • Second Phase: WFG recorded is reduced to detect deadlocks • first phase and Second phase occur serially • Kshemkalyani-Singhal Algorithm – Single Phase and Both sweeps are done concurrently – Fan-out sweep msgs outward from the initiator process – Fan-in sweep msgs inward to the initiator process – Sweep of WFG is a traversal of the WFG – Fan-out: msg will traverse along the edges in edge direction – Fan-in: msg will traverse along the edges in opposite edge direction – In the inward sweep, recorded WFG is reduced to determine whether initiator is deadlocked or not 17 A GLOBAL STATE DETECTION BASED ALGORITHM
  • 18. 18 SYSTEM MODEL 1. System has N nodes 2. Nodes connected to other by a logical channel 3. Event in a computation – Internal, msg sent, msg receive 4. Events are assigned timestamp as per Lamport’s clock 5. Event occurred at time t on node i is given by ti 6. Computation msg can be REQUEST, REPLY or CANCEL 7. A node sends REQUEST to other nodes when it blocks 8. when node I blocks on node j, node j becomes successor of node i in WFG 9. A reply msg denotes the granting of request 10. A node i unblocks when Pi out of its Qi request are granted 11. When node unblocks, sends CANCEL msg to withdraw the remaining requests it had sent
  • 19. 19
  • 20. • Sites are arranged in Hierarchical fashion • Site is responsible for detecting deadlocks involving only its children sites • Localized to a cluster of sites • Two different algorithms – The Menasce-Muntz Algorithm • Controllers are arranged in tree fashion • Controllers manage resources and detects deadlocks • Controllers at the bottom most(leaf controllers) manages the resources • Non leaf controllers are responsible for deadlock detection • A leaf controller maintains part of global WFG concerned with the resources allocated by it • A non leaf controller maintains all TWF graph spanning its children and responsible for detecting deadlocks involving all its children • If change occurs in TWF due to allocation, wait or release – it propagates to its parent controller • Parent controller updates TWF and checks for cycles, propagates up if necessary 20 HIERARCHICAL DEADLOCK DETECTION ALGORITHMS
  • 21. The Ho-Ramamoorthy Algorithm • Sites are grouped into several disjoint clusters • A site is chosen as central control site, which dynamically chooses control site for clusters • Central CS requests each cluster CS for transaction status and wait-for relations • Central CS after collecting status table from all clusters applies one-phase deadlock detection algorithm for intracluster deadlocks • Central CS send intercluster information to cluster CS • Cluster CS splices the information constructs the WFG and checks for cycles 21