SlideShare a Scribd company logo
1 of 8
Download to read offline
DISTRIBUTED DEADLOCK



Abstract:
A deadlock is a condition in a system where a process cannot proceed because it needs to
obtain a resource held by another process but it itself is holding a resource that the other
process needs. In a system of processes which communicate only with a single central
agent, deadlock can be detected easily because the central agent has complete information
about every process. Deadlock detection is more difficult in systems where there is no such
central agent and processes may communicate directly with one another. If we could
assume that message communication is instantaneous, or if we could place certain
restrictions on message delays, deadlock detection would become simpler. However, the
only realistic general assumption we can make is that message delays are arbitrary but
finite. Deadlock is a fundamental problem in distributed systems. A process may request
resources in any order, which may not be known a priori and a process can request
resource while holding others. If the sequence of the allocations of resources to the
processes is not controlled, deadlocks can occur. Moreover, a deadlock is a state where a
set of processes request resources that are held by other processes in the set.


Types of Deadlock:

Two types of deadlock can be considered:

    Communication Deadlock
    Resource Deadlock

Communication deadlock occurs when process A is trying to send a message to process B,
which is trying to send a message to process C which is trying to send a message to A.

Resource deadlock occurs when processes are trying to get exclusive access to devices,
files, locks, servers, or other resources. We will not differentiate between these types of
deadlock since we can consider communication channels to be resources without loss of
generality.

Conditions for Deadlock:

Four conditions have to be met for a deadlock to occur in a system:

1. Mutual exclusion
A resource can be held by at most one process.

2. Hold and wait
Processes that already hold resources can wait for another resource.

1|Page
DISTRIBUTED DEADLOCK


3. Non-preemption
A resource, once granted, cannot be taken away.

4. Circular wait
Two or more processes are waiting for resources held by one of the other processes.

Resource allocation can be represented by directed graphs:
P1      R1 means that resource R1 is allocated to process P1.
P1     R1 means that resource R1 is requested by process P1.
Deadlock is present when the graph has cycles. An example is shown in Figure 1.




                         Figure 1: Deadlock.



Wait for Graph:

The state of the system can be modeled by directed graph, called a wait for graph (WFG). In
a WFG, nodes are processes and there is a directed edge from node P1 to mode P2 if P1 is
blocked and is waiting for P2 to release some resource. A system is deadlocked if and only
if there exists a directed cycle or knot in the WFG.A

Figure 1 shows a WFG, where process P11 of site 1 has an edge to process P21 of site 1 and
P32 of site 2 is waiting for a resource which is currently held by process P21. At the same
time process P32 is waiting on process P33 to release a resource. If P21 is waiting on
process P11, then processes P11, P32 and P21 form a cycle and all the four processes are
involved in a deadlock depending upon the request model.

2|Page
DISTRIBUTED DEADLOCK




                          Figure 2: A Wait-for-Graph.


Handling Deadlocks in Distributed Systems:

Deadlocks in distributed systems are similar to deadlocks in centralized systems. In
centralized systems, we have one operating system that can oversee resource allocation
and know whether deadlocks are present. With distributed processes and resources it
becomes harder to detect, avoid, and prevent deadlocks. Several strategies can be used to
handle deadlocks:

Ignore: We can ignore the problem. This is one of the most popular solutions.

Detect: We can allow deadlocks to occur, then detect that we have a deadlock in the
system, and then deal with the deadlock.

Prevent: We can place constraints on resource allocation to make deadlocks impossible.

Avoid: We can choose resource allocation carefully and make deadlocks impossible.



3|Page
DISTRIBUTED DEADLOCK

Deadlock avoidance is never used (either in distributed or centralized systems). The
problem with deadlock avoidance is that the algorithm will need to know resource usage
requirements in advance so as to schedule them properly. Whereas, the first of these is
trivially simple. The other two are described in details:

Deadlock Detection:
General methods for preventing or avoiding deadlocks can be difficult to find. Detecting a
deadlock condition is generally easier. When a deadlock is detected, it has to be broken.
This is traditionally done by killing one or more processes that contribute to the deadlock.
Unfortunately, this can lead to annoyed users. When a deadlock is detected in a system that
is based on atomic transactions, it is resolved by aborting one or more transactions. But
transactions have been designed to withstand being aborted. Consequences of killing a
process in a transactional system are less severe.

Centralized:

Centralized deadlock detection attempts to imitate the nondistributed algorithm through a
central coordinator. Each machine is responsible for maintaining a resource graph for its
processes and resources. A central coordinator maintains the resource utilization graph
for the entire system. This graph is the union of the individual graphs. If this coordinator
detects a cycle, it kills off one process to break the deadlock. In the non-distributed case, all
the information on resource usage lives on one system and the graph may be constructed
on that system. In the distributed case, the individual sub graphs have to be propagated to a
central coordinator. A message can be sent each time an arc is added or deleted. If
optimization is needed, a list of added or deleted arcs can be sent periodically to reduce the
overall number of messages sent.

Here is an example. Suppose machine A has a process P0, which holds the resource S and
wants resource R, which is held by P1. The local graph on A is shown in Figure 2. Another
machine, machine B has a process P2, which is holding resource T and wants resource S. Its
local graph is shown in Figure 3. Both of these machines send their graphs to the central
coordinator, which maintains the union (Figure 3).
All is well. There are no cycles and hence no deadlocks. Now two events occur. Process P1
releases resource R and asks machine B for resource T. Two messages are sent to the
coordinator:

Message 1 (from machine A): “releasing R”
Message 2 (from machine B): “waiting for T”

This should cause no problems (no deadlock). However, if message 2 arrives first, the
coordinator would then construct the graph in Figure 4 and detect a deadlock. Such a
condition is known as false deadlock. A way to fix this is to use Lamport’s algorithm to
impose global time ordering on all machines. Alternatively, if the coordinator suspects
deadlock, it can send a reliable message to every machine asking whether it has any release

4|Page
DISTRIBUTED DEADLOCK

messages. Each machine will then respond with either a release message or a negative
acknowledgement to acknowledge receipt of the message.




                  Figure 3: Centralized Deadlock Detection.




                          Figure 4: False Deadlock.
5|Page
DISTRIBUTED DEADLOCK


Distributed:

An algorithm for detecting deadlocks in a distributed system was proposed by Chaudy,
Misra, and Haas in 1983. It allows that processes to request multiple resources at once (this
speeds up the growing phase). Some processes may wait for resources (either local or
remote). Cross-machine arcs make looking for cycles (detecting deadlock) hard. The
algorithm works this way: When a process has to wait for a resource, a probe message is
sent to the process holding the resource. The probe message contains three components:
the process that blocked, the process that is sending the request, and the destination.
Initially, the first two components will be the same. When a process receives the probe: if
the process itself is waiting on a resource, it updates the sending and destination fields of
the message and forwards it to the resource holder. If it is waiting on multiple resources, a
message is sent to each process holding the resources. This process continues as long as
processes are waiting for resources. If the originator gets a message and sees its own
process number in the blocked field of the message, it knows that a cycle has been taken
and deadlock exists. In this case, some process (transaction) will have to die. The sender
may choose to commit suicide or a ring election algorithm may be used to determine an
alternate victim (e.g., youngest process, oldest process).

Deadlock prevention
An alternative to detecting deadlocks is to design a system so that deadlock is impossible.
One way of accomplishing this is to obtain a global timestamp for every transaction (so that
no two transactions get the same timestamp). When one process is about to block waiting
for a resource that another process is using, check which of the two processes has a
younger timestamp and give priority to the older process.

If a younger process is using the resource, then the older process (that wants the resource)
waits. If an older process is holding the resource, the younger process (that wants the
resource) kills itself. This forces the resource utilization graph to be directed from older to
younger processes, making cycles impossible. This algorithm is known as the wait-die
algorithm (Figure 5).


An alternative method by which resource request cycles may be avoided is to have an old
process preempt (kill) the younger process that holds a resource. If a younger process
wants a resource that an older one is using, then it waits until the old process is done. In
this case, the graph flows from young to old and cycles are again impossible. This variant is
called the wound-wait algorithm (Figure 6).




6|Page
DISTRIBUTED DEADLOCK




          Figure 5: Wait-die Algorithm.




         Figure 6: Wound-wait Algorithm.




7|Page
DISTRIBUTED DEADLOCK


Conclusion:

Deadlock is the state of permanent blocking of a set of processes each of which is waiting
for an event that only another process in the set can cause. 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.




……………………………………………………………….X……………………………………………………………………




8|Page

More Related Content

What's hot

distributed shared memory
 distributed shared memory distributed shared memory
distributed shared memoryAshish Kumar
 
Chapter 12 transactions and concurrency control
Chapter 12 transactions and concurrency controlChapter 12 transactions and concurrency control
Chapter 12 transactions and concurrency controlAbDul ThaYyal
 
Chapter 4 a interprocess communication
Chapter 4 a interprocess communicationChapter 4 a interprocess communication
Chapter 4 a interprocess communicationAbDul ThaYyal
 
2. Distributed Systems Hardware & Software concepts
2. Distributed Systems Hardware & Software concepts2. Distributed Systems Hardware & Software concepts
2. Distributed Systems Hardware & Software conceptsPrajakta Rane
 
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
 
Fault tolerance in distributed systems
Fault tolerance in distributed systemsFault tolerance in distributed systems
Fault tolerance in distributed systemssumitjain2013
 
Synchronization in distributed systems
Synchronization in distributed systems Synchronization in distributed systems
Synchronization in distributed systems SHATHAN
 
Remote invocation
Remote invocationRemote invocation
Remote invocationishapadhy
 
Distributed Transactions(flat and nested) and Atomic Commit Protocols
Distributed Transactions(flat and nested) and Atomic Commit ProtocolsDistributed Transactions(flat and nested) and Atomic Commit Protocols
Distributed Transactions(flat and nested) and Atomic Commit ProtocolsSachin Chauhan
 
Network security - OSI Security Architecture
Network security - OSI Security ArchitectureNetwork security - OSI Security Architecture
Network security - OSI Security ArchitectureBharathiKrishna6
 
Distributed shred memory architecture
Distributed shred memory architectureDistributed shred memory architecture
Distributed shred memory architectureMaulik Togadiya
 
Distributed System-Multicast & Indirect communication
Distributed System-Multicast & Indirect communicationDistributed System-Multicast & Indirect communication
Distributed System-Multicast & Indirect communicationMNM Jain Engineering College
 
Models of Distributed System
Models of Distributed SystemModels of Distributed System
Models of Distributed SystemAshish KC
 
File models and file accessing models
File models and file accessing modelsFile models and file accessing models
File models and file accessing modelsishmecse13
 
Scheduling in Cloud Computing
Scheduling in Cloud ComputingScheduling in Cloud Computing
Scheduling in Cloud ComputingHitesh Mohapatra
 
Naming in Distributed Systems
Naming in Distributed SystemsNaming in Distributed Systems
Naming in Distributed SystemsNandakumar P
 
deadlock handling
deadlock handlingdeadlock handling
deadlock handlingSuraj Kumar
 

What's hot (20)

distributed shared memory
 distributed shared memory distributed shared memory
distributed shared memory
 
Distributed Deadlock Detection.ppt
Distributed Deadlock Detection.pptDistributed Deadlock Detection.ppt
Distributed Deadlock Detection.ppt
 
Chapter 12 transactions and concurrency control
Chapter 12 transactions and concurrency controlChapter 12 transactions and concurrency control
Chapter 12 transactions and concurrency control
 
Chapter 4 a interprocess communication
Chapter 4 a interprocess communicationChapter 4 a interprocess communication
Chapter 4 a interprocess communication
 
2. Distributed Systems Hardware & Software concepts
2. Distributed Systems Hardware & Software concepts2. Distributed Systems Hardware & Software concepts
2. Distributed Systems Hardware & Software concepts
 
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
 
Fault tolerance in distributed systems
Fault tolerance in distributed systemsFault tolerance in distributed systems
Fault tolerance in distributed systems
 
Message passing in Distributed Computing Systems
Message passing in Distributed Computing SystemsMessage passing in Distributed Computing Systems
Message passing in Distributed Computing Systems
 
Process Management-Process Migration
Process Management-Process MigrationProcess Management-Process Migration
Process Management-Process Migration
 
Synchronization in distributed systems
Synchronization in distributed systems Synchronization in distributed systems
Synchronization in distributed systems
 
Remote invocation
Remote invocationRemote invocation
Remote invocation
 
Distributed Transactions(flat and nested) and Atomic Commit Protocols
Distributed Transactions(flat and nested) and Atomic Commit ProtocolsDistributed Transactions(flat and nested) and Atomic Commit Protocols
Distributed Transactions(flat and nested) and Atomic Commit Protocols
 
Network security - OSI Security Architecture
Network security - OSI Security ArchitectureNetwork security - OSI Security Architecture
Network security - OSI Security Architecture
 
Distributed shred memory architecture
Distributed shred memory architectureDistributed shred memory architecture
Distributed shred memory architecture
 
Distributed System-Multicast & Indirect communication
Distributed System-Multicast & Indirect communicationDistributed System-Multicast & Indirect communication
Distributed System-Multicast & Indirect communication
 
Models of Distributed System
Models of Distributed SystemModels of Distributed System
Models of Distributed System
 
File models and file accessing models
File models and file accessing modelsFile models and file accessing models
File models and file accessing models
 
Scheduling in Cloud Computing
Scheduling in Cloud ComputingScheduling in Cloud Computing
Scheduling in Cloud Computing
 
Naming in Distributed Systems
Naming in Distributed SystemsNaming in Distributed Systems
Naming in Distributed Systems
 
deadlock handling
deadlock handlingdeadlock handling
deadlock handling
 

Viewers also liked

Deadlock detection in distributed systems
Deadlock detection in distributed systemsDeadlock detection in distributed systems
Deadlock detection in distributed systemsReza Ramezani
 
Processes and Processors in Distributed Systems
Processes and Processors in Distributed SystemsProcesses and Processors in Distributed Systems
Processes and Processors in Distributed SystemsDr Sandeep Kumar Poonia
 
Distributes objects and Rmi
Distributes objects and RmiDistributes objects and Rmi
Distributes objects and RmiMayank Jain
 
Communication primitives
Communication primitivesCommunication primitives
Communication primitivesStudent
 
B trees in Data Structure
B trees in Data StructureB trees in Data Structure
B trees in Data StructureAnuj Modi
 
Aggrement protocols
Aggrement protocolsAggrement protocols
Aggrement protocolsMayank Jain
 
Unit 1 architecture of distributed systems
Unit 1 architecture of distributed systemsUnit 1 architecture of distributed systems
Unit 1 architecture of distributed systemskaran2190
 

Viewers also liked (7)

Deadlock detection in distributed systems
Deadlock detection in distributed systemsDeadlock detection in distributed systems
Deadlock detection in distributed systems
 
Processes and Processors in Distributed Systems
Processes and Processors in Distributed SystemsProcesses and Processors in Distributed Systems
Processes and Processors in Distributed Systems
 
Distributes objects and Rmi
Distributes objects and RmiDistributes objects and Rmi
Distributes objects and Rmi
 
Communication primitives
Communication primitivesCommunication primitives
Communication primitives
 
B trees in Data Structure
B trees in Data StructureB trees in Data Structure
B trees in Data Structure
 
Aggrement protocols
Aggrement protocolsAggrement protocols
Aggrement protocols
 
Unit 1 architecture of distributed systems
Unit 1 architecture of distributed systemsUnit 1 architecture of distributed systems
Unit 1 architecture of distributed systems
 

Similar to Distributed deadlock (20)

Deadlock detection
Deadlock detectionDeadlock detection
Deadlock detection
 
Deadlock and memory management -- Operating System
Deadlock and memory management -- Operating SystemDeadlock and memory management -- Operating System
Deadlock and memory management -- Operating System
 
Operating system Deadlock
Operating system DeadlockOperating system Deadlock
Operating system Deadlock
 
Module3
Module3Module3
Module3
 
Deadlocks prefinal
Deadlocks prefinalDeadlocks prefinal
Deadlocks prefinal
 
Deadlocksprefinal 161014115456
Deadlocksprefinal 161014115456Deadlocksprefinal 161014115456
Deadlocksprefinal 161014115456
 
Unit iv: Deadlocks
Unit iv: DeadlocksUnit iv: Deadlocks
Unit iv: Deadlocks
 
Deadlock
DeadlockDeadlock
Deadlock
 
Deadlocks final
Deadlocks finalDeadlocks final
Deadlocks final
 
Process Synchronization And Deadlocks
Process Synchronization And DeadlocksProcess Synchronization And Deadlocks
Process Synchronization And Deadlocks
 
operating system
operating systemoperating system
operating system
 
operating system
operating systemoperating system
operating system
 
Rdbms
RdbmsRdbms
Rdbms
 
Deadlockproj.pptx
Deadlockproj.pptxDeadlockproj.pptx
Deadlockproj.pptx
 
Os module 2 d
Os module 2 dOs module 2 d
Os module 2 d
 
Operating system - Deadlock
Operating system - DeadlockOperating system - Deadlock
Operating system - Deadlock
 
Process coordination
Process coordinationProcess coordination
Process coordination
 
Deadlock in Operating System
Deadlock in Operating SystemDeadlock in Operating System
Deadlock in Operating System
 
Rdbms
RdbmsRdbms
Rdbms
 
Rdbms
RdbmsRdbms
Rdbms
 

More from Md. Mahedi Mahfuj

More from Md. Mahedi Mahfuj (20)

Bengali optical character recognition system
Bengali optical character recognition systemBengali optical character recognition system
Bengali optical character recognition system
 
Parallel computing chapter 3
Parallel computing chapter 3Parallel computing chapter 3
Parallel computing chapter 3
 
Parallel computing chapter 2
Parallel computing chapter 2Parallel computing chapter 2
Parallel computing chapter 2
 
Parallel computing(2)
Parallel computing(2)Parallel computing(2)
Parallel computing(2)
 
Parallel computing(1)
Parallel computing(1)Parallel computing(1)
Parallel computing(1)
 
Message passing interface
Message passing interfaceMessage passing interface
Message passing interface
 
Advanced computer architecture
Advanced computer architectureAdvanced computer architecture
Advanced computer architecture
 
Parallel searching
Parallel searchingParallel searching
Parallel searching
 
Clustering manual
Clustering manualClustering manual
Clustering manual
 
Matrix multiplication graph
Matrix multiplication graphMatrix multiplication graph
Matrix multiplication graph
 
Strategy pattern
Strategy patternStrategy pattern
Strategy pattern
 
Observer pattern
Observer patternObserver pattern
Observer pattern
 
Mediator pattern
Mediator patternMediator pattern
Mediator pattern
 
Database management system chapter16
Database management system chapter16Database management system chapter16
Database management system chapter16
 
Database management system chapter15
Database management system chapter15Database management system chapter15
Database management system chapter15
 
Database management system chapter12
Database management system chapter12Database management system chapter12
Database management system chapter12
 
Strategies in job search process
Strategies in job search processStrategies in job search process
Strategies in job search process
 
Report writing(short)
Report writing(short)Report writing(short)
Report writing(short)
 
Report writing(long)
Report writing(long)Report writing(long)
Report writing(long)
 
Job search_resume
Job search_resumeJob search_resume
Job search_resume
 

Recently uploaded

DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 

Recently uploaded (20)

DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 

Distributed deadlock

  • 1. DISTRIBUTED DEADLOCK Abstract: A deadlock is a condition in a system where a process cannot proceed because it needs to obtain a resource held by another process but it itself is holding a resource that the other process needs. In a system of processes which communicate only with a single central agent, deadlock can be detected easily because the central agent has complete information about every process. Deadlock detection is more difficult in systems where there is no such central agent and processes may communicate directly with one another. If we could assume that message communication is instantaneous, or if we could place certain restrictions on message delays, deadlock detection would become simpler. However, the only realistic general assumption we can make is that message delays are arbitrary but finite. Deadlock is a fundamental problem in distributed systems. A process may request resources in any order, which may not be known a priori and a process can request resource while holding others. If the sequence of the allocations of resources to the processes is not controlled, deadlocks can occur. Moreover, a deadlock is a state where a set of processes request resources that are held by other processes in the set. Types of Deadlock: Two types of deadlock can be considered:  Communication Deadlock  Resource Deadlock Communication deadlock occurs when process A is trying to send a message to process B, which is trying to send a message to process C which is trying to send a message to A. Resource deadlock occurs when processes are trying to get exclusive access to devices, files, locks, servers, or other resources. We will not differentiate between these types of deadlock since we can consider communication channels to be resources without loss of generality. Conditions for Deadlock: Four conditions have to be met for a deadlock to occur in a system: 1. Mutual exclusion A resource can be held by at most one process. 2. Hold and wait Processes that already hold resources can wait for another resource. 1|Page
  • 2. DISTRIBUTED DEADLOCK 3. Non-preemption A resource, once granted, cannot be taken away. 4. Circular wait Two or more processes are waiting for resources held by one of the other processes. Resource allocation can be represented by directed graphs: P1 R1 means that resource R1 is allocated to process P1. P1 R1 means that resource R1 is requested by process P1. Deadlock is present when the graph has cycles. An example is shown in Figure 1. Figure 1: Deadlock. Wait for Graph: The state of the system can be modeled by directed graph, called a wait for graph (WFG). In a WFG, nodes are processes and there is a directed edge from node P1 to mode P2 if P1 is blocked and is waiting for P2 to release some resource. A system is deadlocked if and only if there exists a directed cycle or knot in the WFG.A Figure 1 shows a WFG, where process P11 of site 1 has an edge to process P21 of site 1 and P32 of site 2 is waiting for a resource which is currently held by process P21. At the same time process P32 is waiting on process P33 to release a resource. If P21 is waiting on process P11, then processes P11, P32 and P21 form a cycle and all the four processes are involved in a deadlock depending upon the request model. 2|Page
  • 3. DISTRIBUTED DEADLOCK Figure 2: A Wait-for-Graph. Handling Deadlocks in Distributed Systems: Deadlocks in distributed systems are similar to deadlocks in centralized systems. In centralized systems, we have one operating system that can oversee resource allocation and know whether deadlocks are present. With distributed processes and resources it becomes harder to detect, avoid, and prevent deadlocks. Several strategies can be used to handle deadlocks: Ignore: We can ignore the problem. This is one of the most popular solutions. Detect: We can allow deadlocks to occur, then detect that we have a deadlock in the system, and then deal with the deadlock. Prevent: We can place constraints on resource allocation to make deadlocks impossible. Avoid: We can choose resource allocation carefully and make deadlocks impossible. 3|Page
  • 4. DISTRIBUTED DEADLOCK Deadlock avoidance is never used (either in distributed or centralized systems). The problem with deadlock avoidance is that the algorithm will need to know resource usage requirements in advance so as to schedule them properly. Whereas, the first of these is trivially simple. The other two are described in details: Deadlock Detection: General methods for preventing or avoiding deadlocks can be difficult to find. Detecting a deadlock condition is generally easier. When a deadlock is detected, it has to be broken. This is traditionally done by killing one or more processes that contribute to the deadlock. Unfortunately, this can lead to annoyed users. When a deadlock is detected in a system that is based on atomic transactions, it is resolved by aborting one or more transactions. But transactions have been designed to withstand being aborted. Consequences of killing a process in a transactional system are less severe. Centralized: Centralized deadlock detection attempts to imitate the nondistributed algorithm through a central coordinator. Each machine is responsible for maintaining a resource graph for its processes and resources. A central coordinator maintains the resource utilization graph for the entire system. This graph is the union of the individual graphs. If this coordinator detects a cycle, it kills off one process to break the deadlock. In the non-distributed case, all the information on resource usage lives on one system and the graph may be constructed on that system. In the distributed case, the individual sub graphs have to be propagated to a central coordinator. A message can be sent each time an arc is added or deleted. If optimization is needed, a list of added or deleted arcs can be sent periodically to reduce the overall number of messages sent. Here is an example. Suppose machine A has a process P0, which holds the resource S and wants resource R, which is held by P1. The local graph on A is shown in Figure 2. Another machine, machine B has a process P2, which is holding resource T and wants resource S. Its local graph is shown in Figure 3. Both of these machines send their graphs to the central coordinator, which maintains the union (Figure 3). All is well. There are no cycles and hence no deadlocks. Now two events occur. Process P1 releases resource R and asks machine B for resource T. Two messages are sent to the coordinator: Message 1 (from machine A): “releasing R” Message 2 (from machine B): “waiting for T” This should cause no problems (no deadlock). However, if message 2 arrives first, the coordinator would then construct the graph in Figure 4 and detect a deadlock. Such a condition is known as false deadlock. A way to fix this is to use Lamport’s algorithm to impose global time ordering on all machines. Alternatively, if the coordinator suspects deadlock, it can send a reliable message to every machine asking whether it has any release 4|Page
  • 5. DISTRIBUTED DEADLOCK messages. Each machine will then respond with either a release message or a negative acknowledgement to acknowledge receipt of the message. Figure 3: Centralized Deadlock Detection. Figure 4: False Deadlock. 5|Page
  • 6. DISTRIBUTED DEADLOCK Distributed: An algorithm for detecting deadlocks in a distributed system was proposed by Chaudy, Misra, and Haas in 1983. It allows that processes to request multiple resources at once (this speeds up the growing phase). Some processes may wait for resources (either local or remote). Cross-machine arcs make looking for cycles (detecting deadlock) hard. The algorithm works this way: When a process has to wait for a resource, a probe message is sent to the process holding the resource. The probe message contains three components: the process that blocked, the process that is sending the request, and the destination. Initially, the first two components will be the same. When a process receives the probe: if the process itself is waiting on a resource, it updates the sending and destination fields of the message and forwards it to the resource holder. If it is waiting on multiple resources, a message is sent to each process holding the resources. This process continues as long as processes are waiting for resources. If the originator gets a message and sees its own process number in the blocked field of the message, it knows that a cycle has been taken and deadlock exists. In this case, some process (transaction) will have to die. The sender may choose to commit suicide or a ring election algorithm may be used to determine an alternate victim (e.g., youngest process, oldest process). Deadlock prevention An alternative to detecting deadlocks is to design a system so that deadlock is impossible. One way of accomplishing this is to obtain a global timestamp for every transaction (so that no two transactions get the same timestamp). When one process is about to block waiting for a resource that another process is using, check which of the two processes has a younger timestamp and give priority to the older process. If a younger process is using the resource, then the older process (that wants the resource) waits. If an older process is holding the resource, the younger process (that wants the resource) kills itself. This forces the resource utilization graph to be directed from older to younger processes, making cycles impossible. This algorithm is known as the wait-die algorithm (Figure 5). An alternative method by which resource request cycles may be avoided is to have an old process preempt (kill) the younger process that holds a resource. If a younger process wants a resource that an older one is using, then it waits until the old process is done. In this case, the graph flows from young to old and cycles are again impossible. This variant is called the wound-wait algorithm (Figure 6). 6|Page
  • 7. DISTRIBUTED DEADLOCK Figure 5: Wait-die Algorithm. Figure 6: Wound-wait Algorithm. 7|Page
  • 8. DISTRIBUTED DEADLOCK Conclusion: Deadlock is the state of permanent blocking of a set of processes each of which is waiting for an event that only another process in the set can cause. 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. ……………………………………………………………….X…………………………………………………………………… 8|Page