Open In App

Distributed System – Types of Distributed Deadlock

Last Updated : 17 Dec, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

A Deadlock is a situation where a set of processes are blocked because each process is holding a resource and waiting for another resource occupied by some other process. When this situation arises, it is known as Deadlock. 

Deadlock

A Distributed System is a Network of Machines that can exchange information with each other through Message-passing. It can be very useful as it helps in resource sharing. In such an environment, if the sequence of resource allocation to processes is not controlled, a deadlock may occur. In principle, deadlocks in distributed systems are similar to deadlocks in centralized systems. Therefore, the description of deadlocks presented above holds good both for centralized and distributed systems. However, handling of deadlocks in distributed systems is more complex than in centralized systems because the resources, the processes, and other relevant information are scattered on different nodes of the system.

Three commonly used strategies to handle deadlocks are as follows:

  • Avoidance: Resources are carefully allocated to avoid deadlocks.
  • Prevention: Constraints are imposed on the ways in which processes request resources in order to prevent deadlocks.
  • Detection and recovery: Deadlocks are allowed to occur and a detection algorithm is used to detect them. After a deadlock is detected, it is resolved by certain means.

Types of Distributed Deadlock:

There are two types of Deadlocks in Distributed System:

Resource Deadlock: A resource deadlock occurs when two or more processes wait permanently for resources held by each other.

  • A process that requires certain resources for its execution, and cannot proceed until it has acquired all those resources.
  • It will only proceed to its execution when it has acquired all required resources.
  • It can also be represented using AND condition as the process will execute only if it has all the required resources.
  • Example: Process 1 has R1, R2, and requests resources R3. It will not execute if any one of them is missing. It will proceed only when it acquires all requested resources i.e. R1, R2, and R3.

figure 1: Resource Deadlock

Communication Deadlock: On the other hand, a communication deadlock occurs among a set of processes when they are blocked waiting for messages from other processes in the set in order to start execution but there are no messages in transit between them. When there are no messages in transit between any pair of processes in the set, none of the processes will ever receive a message. This implies that all processes in the set are deadlocked. Communication deadlocks can be easily modeled by using WFGs to indicate which processes are waiting to receive messages from which other processes. Hence, the detection of communication deadlocks can be done in the same manner as that for systems having only one unit of each resource type.

  • In Communication Model, a Process requires resources for its execution and proceeds when it has acquired at least one of the resources it has requested for.
  • Here resource stands for a process to communicate with.
  • Here, a Process waits for communicating with another process in a set of processes. In a situation where each process in a set, is waiting to communicate with another process which itself is waiting to communicate with some other process, this situation is called communication deadlock.
  • For 2 processes to communicate, each one should be in the unblocked state.
  • It can be represented using OR conditions as it requires at least one of the resources to continue its Process.
  • Example: In a Distributed System network, Process 1 is trying to communicate with Process 2, Process 2 is trying to communicate with Process 3 and Process 3 is trying to communicate with Process 1. In this situation, none of the processes will get unblocked and a communication deadlock occurs.

figure 2: Communication Deadlock


Previous Article
Next Article

Similar Reads

Hierarchical Deadlock Detection in Distributed System
Prerequisite: Deadlock detection in Distributed systems In hierarchical deadlock detection algorithm, sites are arranged in a hierarchical fashion and a site detects deadlocks involving only its descendant sites. Distributed deadlock algorithms delegate the responsibility of deadlock detection to individual sites while in hierarchical there are loc
3 min read
Deadlock Prevention Policies in Distributed System
A Deadlock is a situation where a set of processes are blocked because each process is holding a resource and waiting for a resource that is held by some other process. There are four necessary conditions for a Deadlock to happen which are: Mutual Exclusion: There is at least one resource that is non-sharable and can be used by only one Process at
4 min read
Deadlock Handling Strategies in Distributed System
The following are the strategies used for Deadlock Handling in Distributed System: Deadlock PreventionDeadlock AvoidanceDeadlock Detection and Recovery1. Deadlock Prevention: As the name implies, this strategy ensures that deadlock can never happen because system designing is carried out in such a way. If any one of the deadlock-causing conditions
6 min read
Conditions for Deadlock in Distributed System
This article will go through the concept of conditions for deadlock in distributed systems. Deadlock refers to the state when two processes compete for the same resource and end up locking the resource by one of the processes and the other one is prevented from acquiring that resource. [caption width="800"] [/caption]Consider the following scenario
7 min read
Wait For Graph Deadlock Detection in Distributed System
Deadlocks are a fundamental problem in distributed systems. A process may request resources in any order and a process can request resources while holding others. A Deadlock is a situation where a set of processes are blocked as each process in a Distributed system is holding some resources and that acquired resources are needed by some other proce
6 min read
Deadlock Avoidance in Distributed System
Deadlocks are the fundamental problems in distributed systems. A Deadlock is a situation where a set of processes are blocked as each process in a Distributed system is holding some resources and that acquired resources are needed by some other processes. In this situation, a cycle arrives at a deadlock. [caption width="800"] [/caption]Conditions o
6 min read
Phantom Deadlock in Distributed System
Phantom deadlocks, in distributed systems, refer to situations where multiple processes or threads get stuck and can't move forward because of conflicts in synchronization and resource allocation. This happens when different tasks are being executed at the time causing each process to wait for a resource that is held by another process. This create
4 min read
Deadlock Detection in Distributed Systems
Prerequisite - Deadlock Introduction, deadlock detection In the centralized approach of deadlock detection, two techniques are used namely: Completely centralized algorithm and Ho Ramamurthy algorithm (One phase and Two-phase). Completely Centralized Algorithm - In a network of n sites, one site is chosen as a control site. This site is responsible
2 min read
WFG-Based Distributed Algorithm For Deadlock Detection
In distributed computing systems, deadlocks can occur when multiple processes are unable to proceed due to circular dependencies in resource allocation. Detecting and resolving deadlocks is crucial to maintain system integrity and prevent disruptions in critical operations. The WFG-based (Wait-for-Graph-based) distributed algorithm for deadlock det
4 min read
Deadlock detection in Distributed systems
In a distributed system deadlock can neither be prevented nor avoided as the system is so vast that it is impossible to do so. Therefore, only deadlock detection can be implemented. The techniques of deadlock detection in the distributed system require the following: Progress - The method should be able to detect all the deadlocks in the system. Sa
3 min read
Article Tags :