0% found this document useful (0 votes)
18 views5 pages

Session 26

Uploaded by

180050030ecm
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views5 pages

Session 26

Uploaded by

180050030ecm
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Lecture Notes on Distributed Deadlock Detection Algorithms

1. Introduction to Distributed Deadlock


 Distributed Systems consist of multiple processes running on different
machines that may need to share resources, communicate, and
synchronize.
 Deadlock occurs when a group of processes in the system get stuck
because each process is waiting for a resource held by another process in
the group.
 Distributed Deadlock Detection is more challenging than centralized
systems due to:
o Lack of global information.

o Messages must be exchanged over a network.

o Network latency and the potential for incomplete or outdated


information.
2. Conditions for Deadlock
A deadlock arises in a system if the following conditions hold simultaneously:
1. Mutual Exclusion: Only one process can hold a resource at a time.
2. Hold and Wait: Processes that are holding resources can request new
ones.
3. No Preemption: Resources cannot be forcibly taken away from a process
holding them.
4. Circular Wait: There exists a set of processes where each process is
waiting for a resource held by the next process in the set, forming a cycle.
In distributed systems, deadlock detection typically focuses on identifying these
circular wait conditions across the processes running on different nodes.
3. Challenges in Distributed Deadlock Detection
 No Global State: No single process or node has complete information
about the entire system.
 Network Delays: Messages may be delayed, lost, or arrive out of order.
 Concurrency: Multiple processes might try to detect deadlocks at the
same time, leading to duplicate detection or false positives/negatives.
4. Models of Distributed Deadlock
There are two common models for describing resource allocation and deadlock in
distributed systems:
1. Wait-for Graph (WFG):
o A WFG is a directed graph where nodes represent processes, and a
directed edge from node P1 to P2 implies that P1 is waiting for a
resource held by P2.
o Deadlock occurs when there is a cycle in the WFG.

o Challenge: In a distributed system, the WFG is distributed across


multiple nodes, making it harder to construct and detect cycles.
2. Resource-Allocation Graph (RAG):
o This graph consists of processes and resources as nodes, and
directed edges represent requests and allocations of resources.
o Cycles in the RAG indicate potential deadlocks.

5. Distributed Deadlock Detection Algorithms


Several algorithms have been proposed for detecting deadlocks in distributed
systems, and they vary in terms of detection techniques, overhead, and
complexity. Here are some key distributed deadlock detection algorithms:
5.1. Centralized Deadlock Detection
 Approach: A central coordinator collects WFG information from all nodes
and checks for cycles.
 Advantages:
o Simple and easy to implement.

o The central coordinator has a complete view of the system.

 Disadvantages:
o Single point of failure.

o Communication overhead increases with system size.

o Scalability issues as the number of processes increases.

5.2. Hierarchical Deadlock Detection


 Approach: The system is divided into regions, and each region has a local
deadlock detector. These local detectors report to a global coordinator if
they suspect a deadlock.
 Advantages:
o Reduced communication overhead compared to centralized
detection.
o More scalable due to the hierarchical structure.

 Disadvantages:
o Delays in detecting global deadlocks, as local detectors may not
have enough information to detect the full deadlock cycle.
5.3. Edge Chasing Algorithms
 Principle: When a process detects that it is waiting for a resource, it
sends a "probe" (or "token") along the edges of the WFG. If the probe
returns to the initiating process, a cycle (i.e., deadlock) is detected.
There are three well-known edge-chasing algorithms:
(i) Chandy-Misra-Haas Algorithm (Probe Algorithm)
 Steps:
1. When a process Pi is waiting for a resource, it sends a probe
message to the process Pj holding the resource.
2. The probe contains information about the initiator, the sender, and
the recipient.
3. If Pj is also waiting for a resource, it forwards the probe to the
process holding that resource.
4. If the probe returns to the initiator, a deadlock is detected.
 Advantages:
o No global coordination is required.

o Simple and works well for distributed systems.

 Disadvantages:
o It can generate high overhead in systems with many processes and
resources, as many probes might be sent.
o May result in unnecessary probes if there is no deadlock.

(ii) Obermarck's Algorithm


 Approach:
1. Each node maintains a local WFG and sends information about
wait-for relationships to other nodes when a process requests a
resource.
2. When a process suspects a deadlock, it initiates a deadlock
detection request.
3. The algorithm performs cycle detection across the combined local
WFGs.
 Advantages:
o No centralized coordinator.

o Better suited for dynamic distributed environments where processes


are constantly changing.
 Disadvantages:
o Detecting cycles in distributed WFGs requires significant
communication overhead.
(iii) Singhal-Kshemkalyani Algorithm
 Approach:
1. This algorithm improves the Chandy-Misra-Haas algorithm by
reducing the number of probes.
2. Processes exchange probe messages in a hierarchical manner,
where a process only forwards a probe if its local WFG might
contribute to a cycle.
 Advantages:
o Fewer messages than traditional edge-chasing algorithms.

o Reduces unnecessary probing in large systems.

 Disadvantages:
o More complex to implement.

5.4. Global Snapshot-Based Algorithms


 Approach: These algorithms try to gather a global snapshot of the
distributed system to check for deadlock.
 Steps:
1. A process takes a snapshot of its local state and sends it to other
processes.
2. Each process sends its local state to a coordinator.
3. The coordinator constructs a global WFG and checks for cycles
(deadlock).
 Advantages:
o Provides a clear view of the system state.

 Disadvantages:
o Gathering a global snapshot is challenging in distributed systems
due to asynchrony and message delays.
o High overhead, especially in large systems.

6. Deadlock Resolution
Once a deadlock is detected, it must be resolved. Several techniques include:
 Abort one or more processes involved in the deadlock.
 Preempt resources from some processes to break the circular wait
condition.
7. Performance Metrics for Deadlock Detection
 Detection Delay: The time it takes for the system to detect a deadlock
after it occurs.
 Message Complexity: The number of messages exchanged between
processes during deadlock detection.
 Overhead: The computational and communication costs associated with
detecting deadlocks.
8. Conclusion
 Distributed deadlock detection is crucial in maintaining resource
availability and ensuring the smooth operation of processes in distributed
systems.
 Each detection algorithm has trade-offs between complexity, message
overhead, and speed of detection.
 Edge-chasing algorithms are widely used due to their simplicity, while
snapshot-based methods provide a more global perspective but are more
costly.
9. References for Further Reading
 Chandy, K. M., Misra, J., & Haas, L. M.: "Distributed Deadlock
Detection."
 Singhal, M., & Kshemkalyani, A. D.: "An Efficient Distributed Deadlock
Detection Algorithm."
 Raynal, M.: "Distributed Algorithms for Message-Passing Systems."
These notes provide an overview of distributed deadlock detection, including the
key concepts, challenges, and some well-known algorithms.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy