SlideShare a Scribd company logo
1 of 28
Synchronization:
Distributed Deadlock Detection
DDD: Introduction
• In distributed systems, a process can request and
release resources (local or remote) in any order, which
may not be known a priori and a process can request
some resources while holding others
• If the sequence of the allocation of resources to
processes is not controlled in such environments,
deadlocks can occur.
• The problem of deadlocks has been generally studied in
distributed systems under the following model:
– The systems have only reusable resources.
– Processes are allowed only exclusive access to resources.
– There is only one copy of each resource.
Introduction (contd.)
• A process can be in two states:
– running or blocked
• In the running state (also called the active state), a
process has all the needed resources and is either
executing or is ready for execution.
• In the blocked state, a process is waiting to acquire
some resources.
• Deadlock is a situation in which a set of processes is
blocked waiting for other process in the set to release
the resource
• Following conditions should hold simultaneously for
deadlock to occur:
1. Mutual Exclusion 2. No preemption
3. Hold and wait 4. Circular Wait
DDD: Resource vs. Communication
Deadlocks
• Two types of deadlocks have been discussed:
– resource deadlock
• Processes can simultaneously wait for several resources and
cannot proceed until they have acquired all those resources
• A set of processes is resource-deadlock if each process in the set
requests resources held by another process in the set and it mush
receive all of the requested resources before it can become
unblocked
– communication deadlock
• Processes wait to communicate with other processes among a set
of processes
• A waiting process can unblock on receiving a communication from
any one of these processes
• A set of processes is communication deadlocked if each process in
the set is waiting to communicate with another process in the set
and no process in the set ever initiates any further communication
until it receives the communication for which it is waiting
DDD: A Graph-Theoretic Model
– The state of process-resource interaction in distributed systems
can be modeled by a bi-partite directed graph called a resource
allocation graph.
– The nodes of this graph are processes and resources of a
system, and the edges of the graph depict assignments or
pending requests.
– A pending request is represented by a request edge directed
from the node of a requesting process to the node of the
requested resource.
– A resource assignment is represented by an assignment edge
directed from the node of an assigned resource to the node of
the assigned process.
– A system is deadlocked if its resource allocation graph contains
a directed cycle or a knot.
DDD: Resource Allocation Graph
Request Edge
Assignment
Edge
R1
R2 R3
R4
P4
P3
P2
P1
DDD: Wait-For Graph
• Wait-For Graphs:
– In distributed systems, the system state can be
modeled or represented by a directed graph, called a
wait-for graph (WFG)
– In a WFG, nodes are processes and there is a
directed edge from node P1 to node P2 if P1 is
blocked and is waiting for P2 to release some
resource
– A system is deadlocked if and only if there is a
directed cycle or knot (depending upon the underlying
model) in the WFG
DDD: Wait-For Graph
P1
P4 P3
P2
DDD: Deadlock handling strategies in
DS
• There are three strategies to handle deadlock
– Deadlock Prevention
– Deadlock Avoidance
– Deadlock Detection and Recovery
• Deadlock handling is complicated to implement
in DS because no one site has accurate
knowledge of the current state of the system and
because every inter-site communication involves
a finite and unpredictable delay
DDD: Deadlock Prevention
• deadlock can be prevented in a DS through following approaches:
– Deadlock can be prevented in a DS through linear ordering of the
resources, simple to implement with less overhead
– Can be achieved either by having a process acquired all the needed
resources simultaneously before it begins execution or by preempting a
process that holds the needed resources
– Can use time-stamping and priority with resource preemption
– To control the preemption each process is assigned a unique priority
– These values are used to decide whether a process will wait for Pj if Pi
has a priority higher than Pj, otherwise Pi is rolled back
– It prevents deadlock because for nay edge Pi Pj, in the wait-for-graph,
Pi has a higher priority then Pj, then a cycle cant exist
– Low priority process will always be rolled back
– It can be avoided by the use of timestamps, two schemes can be used
as following:
Deadlock Prevention (contd.)
• The Wait-Die Scheme:
– A non-preemptive approach
– When process Pi requests a resource currently held
by Pj, Pi is allowed to wait only if it has a smaller
timestamp than does Pj (Pi is older than Pj)
– Otherwise Pi is rolled back
• The Wound-Wait scheme:
– A preemptive approach
– When process Pi requests a resource currently held
by Pj, Pi is allowed to wait only if it has a larger
timestamp than Pj ( pi is younger)
– Otherwise Pj is rolled back (pj is wounded)
DDD: Deadlock Avoidance
• A resource is granted to a process if the resulting global
state is safe ( a global state includes all the processes
and resources of the DS)
• Deadlock is practically impossible to implement because
– Every site ahs to maintain information on the global state of the
system, which translates into huge storage requirements an
dextensive communication costs
– The process of checking for a safe global state must be mutually
exclusive, because if several sites concurrently perform checks
for a safe state they may all find the state safe but the net global
state may not be safe
– Due to the large number of processes and resources it will be
computationally expensive to check for a safe state
DDD: Deadlock Detection and
Recovery
• Requires an examination of the staus of
process-resource interaction for the
presence of cyclical wait
• Two conditions exist in the DS:
– Once a cycle is formed in the WFG, it persists
until its is detected and broken, and
– Cycle detection can proceed concurrently with
the normal activities of a system
– We’ll study the techniques to detect deadlock
in a DS instead of trying to prevent or avoid it
Detection and Recovery (contd.)
• Deadlock detection and resolution entails addressing two
basic issues:
– First, detection of existing deadlocks and
– second resolution of detected deadlocks.
• The detection of deadlocks involves two Issues:
– maintenance of the WFG and
– search of the WFG for the presence of cycles (or knots)
• In distributed systems, a cycle may involve several sites,
so the search for cycles greatly depends upon how the
WFG of the system is represented across the system
• Depending upon the manner in which WFG information
is maintained and the search for cycles is carried out,
there are centralized, distributed, and hierarchical
algorithms for deadlock detection in distributed systems.
Detection and Recovery (contd.)
• Deadlock resolution involves breaking existing
wait-for dependencies in the system WFG to
resolve the deadlock
• It involves rolling back one or more processes
that are deadlocked and assigning their
resources to blocked processes in the deadlock
so that they can resume execution
DDD: Control Organizations
• Centralized Control
– Provided with a control site responsible of constructing WFG
– However, a single point of failure, congested links, continuous
message generation for deadlock detection, are the demerits.
• Distributed Control
– Detection of a global deadlock is shared equally
– Deadlock detection is initiated only when a waiting process is
suspected to be a part of deadlock cycle.
– However, such systems are difficult to design, several sites may
initiate detection for the same deadlock, proof of correctness is
difficult, deadlock resolution is cumbersome.
• Hierarchical Control
– Site detects deadlocks involving only its descendent sites
– Exploits access patterns local to a cluster of sites to efficiently detect
deadlocks.
– However, the control is defeated if most deadlocks span several
clusters.
Centralized Deadlock-
Detection
The Completely Centralized Algorithm
The Ho-Ramamoorthy Algorithms
The Completely Centralized
Algorithm
• A designated site called the Control Site is
provided which maintains the WFG of the entire
system
– It checks the WFG for the existence of deadlock cycles
whenever a request edge is added to the WFG.
• Sites request or release through Request and
Release message for all resources, whether local
or remote.
• However, it is highly inefficient due to
concentration of all messages.
– It imposes larger delays, large communication
overhead, and the congestion of communication links.
– Moreover, the reliability is poor due to single point of
failure.
The Ho-Ramamoorthy Algorithms
• Two proposals to resolve the problems in Centralized
algorithm
– The Two-Phase Algorithm
• Every site maintains a status table containing status of all the
processes initiated at that site.
• A designated site requests the status table from all sites, periodically.
• Two received reports are matched and a WFG is generated based on
the differences.
• The drawback is it may report a false deadlock.
– The One-Phase Algorithm
• It request one status report from each site, however, each site
maintains two status table, i.e. resource & process.
• Resource table keeps track of transactions, whereas the process table
keeps track of resources locked.
• Periodically, a designated site requests both the tables from every
site, constructs a WFG using the information provided by both tables.
• If no cycle is found, then the system is not deadlocked.
Distributed Deadlock
Detection Algorithms
A Path-Pushing Algorithm
An Edge-Chasing Algorithm
A Diffusion Computation Based Algorithm
Global State Detection Based Algorithm
An Overview
• All sites collectively cooperate to detect a cycle in
the state graph that is likely to be distributed over
several sites of the system.
• The algorithm can be initiated whenever a
process is forced to wait.
• The algorithm can be initiated either by the local
site of the process or by the site where the
process waits.
• These algorithm can be divided into four classes,
– Path-pushing algorithm
– Edge-chasing algorithm
– Diffusion computation algorithm
– Global state detection algorithm
An Edge-Chasing Algorithm
• If Pi is locally dependent on itself then declare deadlock
• Else for all Pj and Pk such that
– Pi is locally dependent upon Pj, and
– Pj is waiting on Pk, and
– Pj and Pk are on different sites,
• Send probe(I,j,k) to the home site of Pk
• On receipt of probe(I,j,k), the site takes the following actions:
• If
– Pk is blocked, and
– dependentk(i) is false, and
– Pk has not replied to all requests of Pj,
• then
begin
dependentk(i)=true;
if k=I then declare that Pi is deadlocked
else for all Pm and Pn such that
Pk is locally dependent upon Pm, and
Pm is waiting on Pn and
Pm and Pn are on different sites,
send probe(I,m,n) to the home sites of Pn
end
A Pictorial Example
P1
P2
P3
P6
P7
P4
P5
P9
P8
P10
Probe (1,9,1) Probe (1,3,4)
Probe (1,6,8)
Probe (1,7,10)
Site S3 Site S2
Site S1
Hierarchical Deadlock
Detection Algorithm
The Menasce-Muntz Algorithm
The Ho-Ramamoorthy Algorithm
An Overview
• In hierarchical deadlock detection algorithms, sites are
arranged in a hierarchical fashion, and a site detects
deadlocks involving only its descendant sites
• Hierarchical algorithms exploit access patterns local to a
cluster of sites to efficiently detect deadlocks
• However, hierarchical deadlock detection algorithms
require special care while arranging the sites in a
hierarchy
• For efficiency, most deadlocks should be localized to as
few clusters as possible - the objective of hierarchical
control is defeated if most deadlocks span several clusters
• These algorithms can be divided into two classes,
– The Menasce-Muntz Algorithm
– The Ho-Ramamoorthy Algorithm
The Ho-Ramamoorth Algorithm
• Sites are grouped into several disjoint clusters.
• Periodically, a site is chosen as a central control site,
which dynamically chooses a control site for each cluster.
• The central control site requests from every control site
their intercluster transaction status information and wait-for
relation.
• A control site collects status tables from all the site in its
cluster and applies the one-phase deadlock detection
algorithm.
• It then sends status information and wait-for relation to the
central control site.
• Finally, the central site constructs a system WFG and
searches it for cycles.
A Pictorial Example
Control Site Control Site
Control Site
Central Site
Algorithms Unleashed Perspectives
• Theory of Correctness
– A formal proof of the correctness is nontrivial
• TWF graph and deadlock cycles can form in innumerable ways and it
is difficult to imagine
• Deadlock is very sensitive to the timing of requests
• Message delays are unpredictable
• Performance
– The number of messages exchanges may not be the true indicator
as it varies in algorithms
– The persistence of deadlocks results in wasteful utilization of
resources, therefore, the average time a deadlock persist can be
an important measure
– Other measures include, storage overhead, processing overhead,
resource holding time, etc.
• Deadlock Resolution
– A deadlock is resolved by aborting at least one process and
granting the released resources to other processes.

More Related Content

What's hot

Synchronization in distributed computing
Synchronization in distributed computingSynchronization in distributed computing
Synchronization in distributed computingSVijaylakshmi
 
Distributed datababase Transaction and concurrency control
Distributed datababase Transaction and concurrency controlDistributed datababase Transaction and concurrency control
Distributed datababase Transaction and concurrency controlbalamurugan.k Kalibalamurugan
 
Explain Communication among agents in Artificial Intelligence
Explain Communication among agents in Artificial IntelligenceExplain Communication among agents in Artificial Intelligence
Explain Communication among agents in Artificial IntelligenceGurpreet singh
 
Distributed file system
Distributed file systemDistributed file system
Distributed file systemAnamika Singh
 
RPC: Remote procedure call
RPC: Remote procedure callRPC: Remote procedure call
RPC: Remote procedure callSunita Sahu
 
Directory and discovery services
Directory and discovery servicesDirectory and discovery services
Directory and discovery servicesRamchandraRegmi
 
Agreement Protocols, distributed File Systems, Distributed Shared Memory
Agreement Protocols, distributed File Systems, Distributed Shared MemoryAgreement Protocols, distributed File Systems, Distributed Shared Memory
Agreement Protocols, distributed File Systems, Distributed Shared MemorySHIKHA GAUTAM
 
Deadlock in distribute system by saeed siddik
Deadlock in distribute system by saeed siddikDeadlock in distribute system by saeed siddik
Deadlock in distribute system by saeed siddikSaeed Siddik
 
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
 
Distributed Mutual Exclusion and Distributed Deadlock Detection
Distributed Mutual Exclusion and Distributed Deadlock DetectionDistributed Mutual Exclusion and Distributed Deadlock Detection
Distributed Mutual Exclusion and Distributed Deadlock DetectionSHIKHA GAUTAM
 
remote procedure calls
  remote procedure calls  remote procedure calls
remote procedure callsAshish Kumar
 
Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.Meghaj Mallick
 
Types of Load distributing algorithm in Distributed System
Types of Load distributing algorithm in Distributed SystemTypes of Load distributing algorithm in Distributed System
Types of Load distributing algorithm in Distributed SystemDHIVYADEVAKI
 
CPU Scheduling in OS Presentation
CPU Scheduling in OS  PresentationCPU Scheduling in OS  Presentation
CPU Scheduling in OS Presentationusmankiyani1
 
Database replication
Database replicationDatabase replication
Database replicationArslan111
 
daa-unit-3-greedy method
daa-unit-3-greedy methoddaa-unit-3-greedy method
daa-unit-3-greedy methodhodcsencet
 
Dead Lock in operating system
Dead Lock in operating systemDead Lock in operating system
Dead Lock in operating systemAli Haider
 

What's hot (20)

Synchronization in distributed computing
Synchronization in distributed computingSynchronization in distributed computing
Synchronization in distributed computing
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
Distributed datababase Transaction and concurrency control
Distributed datababase Transaction and concurrency controlDistributed datababase Transaction and concurrency control
Distributed datababase Transaction and concurrency control
 
Explain Communication among agents in Artificial Intelligence
Explain Communication among agents in Artificial IntelligenceExplain Communication among agents in Artificial Intelligence
Explain Communication among agents in Artificial Intelligence
 
Concurrency Control.
Concurrency Control.Concurrency Control.
Concurrency Control.
 
Distributed file system
Distributed file systemDistributed file system
Distributed file system
 
RPC: Remote procedure call
RPC: Remote procedure callRPC: Remote procedure call
RPC: Remote procedure call
 
Directory and discovery services
Directory and discovery servicesDirectory and discovery services
Directory and discovery services
 
Agreement Protocols, distributed File Systems, Distributed Shared Memory
Agreement Protocols, distributed File Systems, Distributed Shared MemoryAgreement Protocols, distributed File Systems, Distributed Shared Memory
Agreement Protocols, distributed File Systems, Distributed Shared Memory
 
Deadlock in distribute system by saeed siddik
Deadlock in distribute system by saeed siddikDeadlock in distribute system by saeed siddik
Deadlock in distribute system by saeed siddik
 
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
 
Mainframe systems
Mainframe systemsMainframe systems
Mainframe systems
 
Distributed Mutual Exclusion and Distributed Deadlock Detection
Distributed Mutual Exclusion and Distributed Deadlock DetectionDistributed Mutual Exclusion and Distributed Deadlock Detection
Distributed Mutual Exclusion and Distributed Deadlock Detection
 
remote procedure calls
  remote procedure calls  remote procedure calls
remote procedure calls
 
Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.
 
Types of Load distributing algorithm in Distributed System
Types of Load distributing algorithm in Distributed SystemTypes of Load distributing algorithm in Distributed System
Types of Load distributing algorithm in Distributed System
 
CPU Scheduling in OS Presentation
CPU Scheduling in OS  PresentationCPU Scheduling in OS  Presentation
CPU Scheduling in OS Presentation
 
Database replication
Database replicationDatabase replication
Database replication
 
daa-unit-3-greedy method
daa-unit-3-greedy methoddaa-unit-3-greedy method
daa-unit-3-greedy method
 
Dead Lock in operating system
Dead Lock in operating systemDead Lock in operating system
Dead Lock in operating system
 

Similar to Distributed Deadlock Detection.ppt

deadlock and starvation resources allocation.pptx
deadlock and starvation resources allocation.pptxdeadlock and starvation resources allocation.pptx
deadlock and starvation resources allocation.pptxSaba651353
 
Unit 3 part 2(DEADLOCK)
Unit 3 part 2(DEADLOCK)Unit 3 part 2(DEADLOCK)
Unit 3 part 2(DEADLOCK)WajeehaBaig
 
OS Module-3 (2).pptx
OS Module-3 (2).pptxOS Module-3 (2).pptx
OS Module-3 (2).pptxKokilaK25
 
DDB_lec_05_Concurrency_Control.pdf
DDB_lec_05_Concurrency_Control.pdfDDB_lec_05_Concurrency_Control.pdf
DDB_lec_05_Concurrency_Control.pdfAhmedImmamImmam
 
Module 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModul...
Module 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModul...Module 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModul...
Module 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModul...morganjohn3
 
Deadlock and memory management -- Operating System
Deadlock and memory management -- Operating SystemDeadlock and memory management -- Operating System
Deadlock and memory management -- Operating SystemEktaVaswani2
 
4.3 Deadlock [Autosaved].pptx
4.3 Deadlock [Autosaved].pptx4.3 Deadlock [Autosaved].pptx
4.3 Deadlock [Autosaved].pptxDishaDwivedi2
 
Process Synchronization And Deadlocks
Process Synchronization And DeadlocksProcess Synchronization And Deadlocks
Process Synchronization And Deadlockstech2click
 
FAULT TOLERANCE OF RESOURCES IN COMPUTATIONAL GRIDS
FAULT TOLERANCE OF RESOURCES IN COMPUTATIONAL GRIDSFAULT TOLERANCE OF RESOURCES IN COMPUTATIONAL GRIDS
FAULT TOLERANCE OF RESOURCES IN COMPUTATIONAL GRIDSMaurvi04
 

Similar to Distributed Deadlock Detection.ppt (20)

ch 2 - DISTRIBUTED DEADLOCK DETECTION.pptx
ch 2 - DISTRIBUTED DEADLOCK DETECTION.pptxch 2 - DISTRIBUTED DEADLOCK DETECTION.pptx
ch 2 - DISTRIBUTED DEADLOCK DETECTION.pptx
 
OS 7.pptx
OS 7.pptxOS 7.pptx
OS 7.pptx
 
Deadlocks2
Deadlocks2Deadlocks2
Deadlocks2
 
Chapter00000000
Chapter00000000Chapter00000000
Chapter00000000
 
Deadlocks Part- I.pdf
Deadlocks Part- I.pdfDeadlocks Part- I.pdf
Deadlocks Part- I.pdf
 
chapter06-new.pptx
chapter06-new.pptxchapter06-new.pptx
chapter06-new.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
 
06-Deadlocks.ppt
06-Deadlocks.ppt06-Deadlocks.ppt
06-Deadlocks.ppt
 
Chapter06.ppt
Chapter06.pptChapter06.ppt
Chapter06.ppt
 
deadlock and starvation resources allocation.pptx
deadlock and starvation resources allocation.pptxdeadlock and starvation resources allocation.pptx
deadlock and starvation resources allocation.pptx
 
Unit 3 part 2(DEADLOCK)
Unit 3 part 2(DEADLOCK)Unit 3 part 2(DEADLOCK)
Unit 3 part 2(DEADLOCK)
 
OS Module-3 (2).pptx
OS Module-3 (2).pptxOS Module-3 (2).pptx
OS Module-3 (2).pptx
 
DDB_lec_05_Concurrency_Control.pdf
DDB_lec_05_Concurrency_Control.pdfDDB_lec_05_Concurrency_Control.pdf
DDB_lec_05_Concurrency_Control.pdf
 
Module 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModul...
Module 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModul...Module 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModul...
Module 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModul...
 
Deadlock and memory management -- Operating System
Deadlock and memory management -- Operating SystemDeadlock and memory management -- Operating System
Deadlock and memory management -- Operating System
 
4.3 Deadlock [Autosaved].pptx
4.3 Deadlock [Autosaved].pptx4.3 Deadlock [Autosaved].pptx
4.3 Deadlock [Autosaved].pptx
 
Process Synchronization And Deadlocks
Process Synchronization And DeadlocksProcess Synchronization And Deadlocks
Process Synchronization And Deadlocks
 
FAULT TOLERANCE OF RESOURCES IN COMPUTATIONAL GRIDS
FAULT TOLERANCE OF RESOURCES IN COMPUTATIONAL GRIDSFAULT TOLERANCE OF RESOURCES IN COMPUTATIONAL GRIDS
FAULT TOLERANCE OF RESOURCES IN COMPUTATIONAL GRIDS
 
Chapter06
Chapter06Chapter06
Chapter06
 
deadlock.ppt
deadlock.pptdeadlock.ppt
deadlock.ppt
 

Recently uploaded

Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
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
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfLivetecs LLC
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 

Recently uploaded (20)

2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
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
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 

Distributed Deadlock Detection.ppt

  • 2. DDD: Introduction • In distributed systems, a process can request and release resources (local or remote) in any order, which may not be known a priori and a process can request some resources while holding others • If the sequence of the allocation of resources to processes is not controlled in such environments, deadlocks can occur. • The problem of deadlocks has been generally studied in distributed systems under the following model: – The systems have only reusable resources. – Processes are allowed only exclusive access to resources. – There is only one copy of each resource.
  • 3. Introduction (contd.) • A process can be in two states: – running or blocked • In the running state (also called the active state), a process has all the needed resources and is either executing or is ready for execution. • In the blocked state, a process is waiting to acquire some resources. • Deadlock is a situation in which a set of processes is blocked waiting for other process in the set to release the resource • Following conditions should hold simultaneously for deadlock to occur: 1. Mutual Exclusion 2. No preemption 3. Hold and wait 4. Circular Wait
  • 4. DDD: Resource vs. Communication Deadlocks • Two types of deadlocks have been discussed: – resource deadlock • Processes can simultaneously wait for several resources and cannot proceed until they have acquired all those resources • A set of processes is resource-deadlock if each process in the set requests resources held by another process in the set and it mush receive all of the requested resources before it can become unblocked – communication deadlock • Processes wait to communicate with other processes among a set of processes • A waiting process can unblock on receiving a communication from any one of these processes • A set of processes is communication deadlocked if each process in the set is waiting to communicate with another process in the set and no process in the set ever initiates any further communication until it receives the communication for which it is waiting
  • 5. DDD: A Graph-Theoretic Model – The state of process-resource interaction in distributed systems can be modeled by a bi-partite directed graph called a resource allocation graph. – The nodes of this graph are processes and resources of a system, and the edges of the graph depict assignments or pending requests. – A pending request is represented by a request edge directed from the node of a requesting process to the node of the requested resource. – A resource assignment is represented by an assignment edge directed from the node of an assigned resource to the node of the assigned process. – A system is deadlocked if its resource allocation graph contains a directed cycle or a knot.
  • 6. DDD: Resource Allocation Graph Request Edge Assignment Edge R1 R2 R3 R4 P4 P3 P2 P1
  • 7. DDD: Wait-For Graph • Wait-For Graphs: – In distributed systems, the system state can be modeled or represented by a directed graph, called a wait-for graph (WFG) – In a WFG, nodes are processes and there is a directed edge from node P1 to node P2 if P1 is blocked and is waiting for P2 to release some resource – A system is deadlocked if and only if there is a directed cycle or knot (depending upon the underlying model) in the WFG
  • 9. DDD: Deadlock handling strategies in DS • There are three strategies to handle deadlock – Deadlock Prevention – Deadlock Avoidance – Deadlock Detection and Recovery • Deadlock handling is complicated to implement in DS because no one site has accurate knowledge of the current state of the system and because every inter-site communication involves a finite and unpredictable delay
  • 10. DDD: Deadlock Prevention • deadlock can be prevented in a DS through following approaches: – Deadlock can be prevented in a DS through linear ordering of the resources, simple to implement with less overhead – Can be achieved either by having a process acquired all the needed resources simultaneously before it begins execution or by preempting a process that holds the needed resources – Can use time-stamping and priority with resource preemption – To control the preemption each process is assigned a unique priority – These values are used to decide whether a process will wait for Pj if Pi has a priority higher than Pj, otherwise Pi is rolled back – It prevents deadlock because for nay edge Pi Pj, in the wait-for-graph, Pi has a higher priority then Pj, then a cycle cant exist – Low priority process will always be rolled back – It can be avoided by the use of timestamps, two schemes can be used as following:
  • 11. Deadlock Prevention (contd.) • The Wait-Die Scheme: – A non-preemptive approach – When process Pi requests a resource currently held by Pj, Pi is allowed to wait only if it has a smaller timestamp than does Pj (Pi is older than Pj) – Otherwise Pi is rolled back • The Wound-Wait scheme: – A preemptive approach – When process Pi requests a resource currently held by Pj, Pi is allowed to wait only if it has a larger timestamp than Pj ( pi is younger) – Otherwise Pj is rolled back (pj is wounded)
  • 12. DDD: Deadlock Avoidance • A resource is granted to a process if the resulting global state is safe ( a global state includes all the processes and resources of the DS) • Deadlock is practically impossible to implement because – Every site ahs to maintain information on the global state of the system, which translates into huge storage requirements an dextensive communication costs – The process of checking for a safe global state must be mutually exclusive, because if several sites concurrently perform checks for a safe state they may all find the state safe but the net global state may not be safe – Due to the large number of processes and resources it will be computationally expensive to check for a safe state
  • 13. DDD: Deadlock Detection and Recovery • Requires an examination of the staus of process-resource interaction for the presence of cyclical wait • Two conditions exist in the DS: – Once a cycle is formed in the WFG, it persists until its is detected and broken, and – Cycle detection can proceed concurrently with the normal activities of a system – We’ll study the techniques to detect deadlock in a DS instead of trying to prevent or avoid it
  • 14. Detection and Recovery (contd.) • Deadlock detection and resolution entails addressing two basic issues: – First, detection of existing deadlocks and – second resolution of detected deadlocks. • The detection of deadlocks involves two Issues: – maintenance of the WFG and – search of the WFG for the presence of cycles (or knots) • In distributed systems, a cycle may involve several sites, so the search for cycles greatly depends upon how the WFG of the system is represented across the system • Depending upon the manner in which WFG information is maintained and the search for cycles is carried out, there are centralized, distributed, and hierarchical algorithms for deadlock detection in distributed systems.
  • 15. Detection and Recovery (contd.) • Deadlock resolution involves breaking existing wait-for dependencies in the system WFG to resolve the deadlock • It involves rolling back one or more processes that are deadlocked and assigning their resources to blocked processes in the deadlock so that they can resume execution
  • 16. DDD: Control Organizations • Centralized Control – Provided with a control site responsible of constructing WFG – However, a single point of failure, congested links, continuous message generation for deadlock detection, are the demerits. • Distributed Control – Detection of a global deadlock is shared equally – Deadlock detection is initiated only when a waiting process is suspected to be a part of deadlock cycle. – However, such systems are difficult to design, several sites may initiate detection for the same deadlock, proof of correctness is difficult, deadlock resolution is cumbersome. • Hierarchical Control – Site detects deadlocks involving only its descendent sites – Exploits access patterns local to a cluster of sites to efficiently detect deadlocks. – However, the control is defeated if most deadlocks span several clusters.
  • 17. Centralized Deadlock- Detection The Completely Centralized Algorithm The Ho-Ramamoorthy Algorithms
  • 18. The Completely Centralized Algorithm • A designated site called the Control Site is provided which maintains the WFG of the entire system – It checks the WFG for the existence of deadlock cycles whenever a request edge is added to the WFG. • Sites request or release through Request and Release message for all resources, whether local or remote. • However, it is highly inefficient due to concentration of all messages. – It imposes larger delays, large communication overhead, and the congestion of communication links. – Moreover, the reliability is poor due to single point of failure.
  • 19. The Ho-Ramamoorthy Algorithms • Two proposals to resolve the problems in Centralized algorithm – The Two-Phase Algorithm • Every site maintains a status table containing status of all the processes initiated at that site. • A designated site requests the status table from all sites, periodically. • Two received reports are matched and a WFG is generated based on the differences. • The drawback is it may report a false deadlock. – The One-Phase Algorithm • It request one status report from each site, however, each site maintains two status table, i.e. resource & process. • Resource table keeps track of transactions, whereas the process table keeps track of resources locked. • Periodically, a designated site requests both the tables from every site, constructs a WFG using the information provided by both tables. • If no cycle is found, then the system is not deadlocked.
  • 20. Distributed Deadlock Detection Algorithms A Path-Pushing Algorithm An Edge-Chasing Algorithm A Diffusion Computation Based Algorithm Global State Detection Based Algorithm
  • 21. An Overview • All sites collectively cooperate to detect a cycle in the state graph that is likely to be distributed over several sites of the system. • The algorithm can be initiated whenever a process is forced to wait. • The algorithm can be initiated either by the local site of the process or by the site where the process waits. • These algorithm can be divided into four classes, – Path-pushing algorithm – Edge-chasing algorithm – Diffusion computation algorithm – Global state detection algorithm
  • 22. An Edge-Chasing Algorithm • If Pi is locally dependent on itself then declare deadlock • Else for all Pj and Pk such that – Pi is locally dependent upon Pj, and – Pj is waiting on Pk, and – Pj and Pk are on different sites, • Send probe(I,j,k) to the home site of Pk • On receipt of probe(I,j,k), the site takes the following actions: • If – Pk is blocked, and – dependentk(i) is false, and – Pk has not replied to all requests of Pj, • then begin dependentk(i)=true; if k=I then declare that Pi is deadlocked else for all Pm and Pn such that Pk is locally dependent upon Pm, and Pm is waiting on Pn and Pm and Pn are on different sites, send probe(I,m,n) to the home sites of Pn end
  • 23. A Pictorial Example P1 P2 P3 P6 P7 P4 P5 P9 P8 P10 Probe (1,9,1) Probe (1,3,4) Probe (1,6,8) Probe (1,7,10) Site S3 Site S2 Site S1
  • 24. Hierarchical Deadlock Detection Algorithm The Menasce-Muntz Algorithm The Ho-Ramamoorthy Algorithm
  • 25. An Overview • In hierarchical deadlock detection algorithms, sites are arranged in a hierarchical fashion, and a site detects deadlocks involving only its descendant sites • Hierarchical algorithms exploit access patterns local to a cluster of sites to efficiently detect deadlocks • However, hierarchical deadlock detection algorithms require special care while arranging the sites in a hierarchy • For efficiency, most deadlocks should be localized to as few clusters as possible - the objective of hierarchical control is defeated if most deadlocks span several clusters • These algorithms can be divided into two classes, – The Menasce-Muntz Algorithm – The Ho-Ramamoorthy Algorithm
  • 26. The Ho-Ramamoorth Algorithm • Sites are grouped into several disjoint clusters. • Periodically, a site is chosen as a central control site, which dynamically chooses a control site for each cluster. • The central control site requests from every control site their intercluster transaction status information and wait-for relation. • A control site collects status tables from all the site in its cluster and applies the one-phase deadlock detection algorithm. • It then sends status information and wait-for relation to the central control site. • Finally, the central site constructs a system WFG and searches it for cycles.
  • 27. A Pictorial Example Control Site Control Site Control Site Central Site
  • 28. Algorithms Unleashed Perspectives • Theory of Correctness – A formal proof of the correctness is nontrivial • TWF graph and deadlock cycles can form in innumerable ways and it is difficult to imagine • Deadlock is very sensitive to the timing of requests • Message delays are unpredictable • Performance – The number of messages exchanges may not be the true indicator as it varies in algorithms – The persistence of deadlocks results in wasteful utilization of resources, therefore, the average time a deadlock persist can be an important measure – Other measures include, storage overhead, processing overhead, resource holding time, etc. • Deadlock Resolution – A deadlock is resolved by aborting at least one process and granting the released resources to other processes.