“Understanding Distributed Deadlocks: Causes, Detection, and Resolution Techniques in Distributed Systems to Prevent Resource Cycles and Improve Reliability. Explore Deadlock Prevention, Avoidance, and Recovery Methods, Including Centralized, Distributed, and Hierarchical Algorithms, for Managing ...
“Understanding Distributed Deadlocks: Causes, Detection, and Resolution Techniques in Distributed Systems to Prevent Resource Cycles and Improve Reliability. Explore Deadlock Prevention, Avoidance, and Recovery Methods, Including Centralized, Distributed, and Hierarchical Algorithms, for Managing Deadlocks in Complex Networked Environments.”
Types of Deadlocks
Conditions for Deadlock
Deadlock Detection
Introduction
to
Deadlock
Distributed Deadlock
Deadlock Handling
Deadlock Avoidance
Deadlock Recovery
What is Deadlock ?
Deadlock is a situation where a set
of processes are blocked because
each process is holding a resource
and waiting for another resource
acquired by some other process.
-Parth Wattamwar
Types Of Deadlock
Resource Deadlocks: These occur when processes are
unable to proceed because each is holding a resource
and waiting for another resource acquired by some
other process.
Communication Deadlocks: In distributed systems, this
happens when processes are unable to communicate
due to some synchronization issues.
Livelocks: A livelock is a special case of deadlock
where two or more processes keep responding to each
other's actions without making progress
-Parth Wattamwar
At least one resource in the system must
be able to be used by only one process
at a time.
One Process at a time can Use a
There must be a process that retains a
resource while waiting for another
resource acquired by some other
process.
1. Mutual exclusion
resource.
2. Hold and wait
Conditions for
Deadlock
It means that resources cannot be taken
forcefully from one process and handed
over to another.
Number of resources can be feasibly
removed from a processor holding it.
All processes must wait for the resource
in a cyclic fashion, with the last process
waiting for the first process's resource.
3.Non-Preemption:-
4.Circular Wait:-
-Parth Wattamwar
What is a Distributed
System
Distributed System is a collection of autonomous computer systems
that are physically separated but are connected by a centralized
computer network that is equipped with distributed system software.
The autonomous computers will communicate among each system by
sharing resources and files and performing the tasks assigned to them.
Distributed System
Functionalities
The most important functions of distributed computing are:
Fault tolerance - how easy and quickly can failures in parts
of the system be detected and recovered
Concurrency - multiple machines can process at the same
time increasing the efficiency and ou
Resource sharing - whether it’s the hardware, software or
data that can be shared
What are Distributed
Deadlocks
Distributed deadlock refers to a scenario in a distributed system
where multiple processes or nodes are unable to proceed because
each is waiting for resources or events that can only be triggered
by another process within the same set.
Conditions for
Deadlocks in Distributed
System
When a Process is Accessing a shared
variable, the process is said to be in a
critical situation.
One Process at a time can Use a
Processes that already hold resources
can wait for another resource.
1. Mutual exclusion
resource.
2. Hold and wait
A Resource can be released only
voluntarily by the process holding it,
after that process has completed it task.
Number of resources can be feasibly
removed from a processor holding it.
Two or more processes are waiting for
resources held by one of the other
processes.
3.Non-Preemption:-
4.Circular Wait:-
In deadlock avoidance, the request for any resource will be granted if the
resulting state of the system doesn't cause deadlock in the system.
The state of the system will continuously be checked for safe and unsafe states.
In order to avoid deadlocks, the process must tell OS, the maximum number of
resources a process can request to complete its execution.
The simplest and most useful approach states that the process should declare
the maximum number of resources of each type it may ever need.
The Deadlock avoidance algorithm examines the resource allocations so that
there can never be a circular wait condition.
Deadloack Avoidance
A state is safe if the system can allocate resources to each process( up to
its maximum requirement) in some order and still avoid a deadlock.
Formally, a system is in a safe state only, if there exists a safe sequence.
So a safe state is not a deadlocked state and conversely a deadlocked
state is an unsafe state.
In an Unsafe state, the operating system cannot prevent processes from
requesting resources in such a way that any deadlock occurs. It is not
necessary that all unsafe states are deadlocks; an unsafe state may lead
to a deadlock.
Safe State and Unsafe State
Max needs of resources by each process.
Currently, allocated resources by each process.
Max free available resources in the system
Inputs to Banker’s Algorithm
1.
2.
3.
Bankers’s Algorithm is a resource allocation and deadlock avoidance
algorithm which test all the request made by processes for resources,
it checks for the safe state, and after granting a request system
remains in the safe state it allows the request, and if there is no safe
state it doesn’t allow the request made by the process.
Banker’s Algorithm
Example Of Dealock Avoidance
Let us consider a system having 12 magnetic
tapes and three processes P1, P2, P3. Process P1
requires 10 magnetic tapes, process P2 may
need as many as 4 tapes, process P3 may need
up to 9 tapes. Suppose at a time to, process P1
is holding 5 tapes, process P2 is holding 2 tapes
and process P3 is holding 2 tapes. (There are 3
free magnetic tapes)
Deadlock Recovery
Recovery from Deadlock in Operating Systems” refers to the
set of techniques and algorithms designed to detect, resolve,
or mitigate deadlock situations. These methods ensure that
the system can continue processing tasks efficiently without
being trapped in an eternal standstill.
There is no mechanism implemented by the OS to
avoid or prevent deadlocks. The system, therefore,
assumes that a deadlock will undoubtedly occur.
Resource :-
Process Termination:-
To eliminate the deadlock, we can simply kill one or more processes.
1.Abort one process at a time until the deadlock is eliminated
2.Abort all the Deadlocked Processes.
Preemption:-Preempt some resources from processes and give those resources to
other processes.
Rollback:-
The system reverses the transactions of the involved processes to a time before the
deadlock.
https://www.geeksforgeeks.org/
https://www.slideshare.net/venkatasreeram/deadlock-in-operatingsystems
https://www.slideshare.net/MahediMahfujAnik/distributed-deadlock
Thank you !
References: