Module 4 Distributed System
Module 4 Distributed System
Department of
Computer Science & Engineering
www.cambridge.edu.in
Failure assumptions and failure detectors
CiTech, BANGALORE
Failure assumptions and failure detectors
CiTech, BANGALORE
Failure assumptions and failure detectors
• One of the problems in the design of algorithms that can
overcome process crashes is that of deciding when a process
has crashed.
• A failure detector is a service that processes queries about
whether a particular process has failed.
• It is often implemented by an object local to each process (on
the same computer) that runs a failure-detection algorithm in
conjunction with its counterparts at other processes.
• The object local to each process is called a local failure
detector.
Failure assumptions and failure detectors
• An unreliable failure detector may produce one of two values
when given the identity of a process:
✓ A result of Unsuspected signifies that the detector has
recently received evidence suggesting that the process has
not failed;
✓ A result of Suspected signifies that the failure detector has
some indication that the process may have failed.
CiTech, BANGALORE
Failure assumptions and failure detectors
• A reliable failure detector is one that is always accurate in
detecting a process’s failure.
CiTech, BANGALORE
Distributed Mutual Exclusion
• If a collection of processes share a resource or collection of
resources, then often mutual exclusion is required to prevent
interference and ensure consistency when accessing the
resources.
CiTech, BANGALORE
Algorithms for mutual exclusion
CiTech, BANGALORE
The central server algorithm
CiTech, BANGALORE
A ring-based algorithm
CiTech, BANGALORE
CiTech, BANGALORE
An algorithm using multicast and logical
clocks
CiTech, BANGALORE
Maekawa’s voting algorithm
• Maekawa observed that in order for a process to enter a critical
section, it is not necessary for all of its peers to grant it access.
CiTech, BANGALORE
Maekawa’s voting algorithm
CiTech, BANGALORE
Maekawa’s voting algorithm
CiTech, BANGALORE
Election
• An algorithm for choosing a unique process to play a particular role
is called an election algorithm.
• A process calls the election if it takes an action that initiates a
particular run of the election algorithm.
• An individual process does not call more than one election at a
time, but in principle the N processes could call N concurrent
elections.
• At any point in time, a process pi is either a participant – meaning
that it is engaged in some run of the election algorithm – or
• a non-participant – meaning that it is not currently engaged in any
election.
CiTech, BANGALORE
Ring-based election algorithm
• The algorithm of Chang and Roberts [1979] is suitable for a
collection of processes arranged in a logical ring.
• Each process pi has a communication channel to the next process
in the ring, and all messages are sent clockwise around the ring.
• We assume that no failures occur, and that the system is
asynchronous.
• The goal of this algorithm is to elect a single process called the
coordinator, which is the process with the largest identifier.
CiTech, BANGALORE
Ring-based election algorithm
CiTech, BANGALORE
Ring-based election algorithm
• When a process receives an election message, it compares the
identifier in the message with its own.
❖ If the arrived identifier is greater, then it forwards the message to
its neighbor.
❖ If the arrived identifier is smaller and the receiver is not a
participant, then it substitutes its own identifier in the message
and forwards it; but it does not forward the message if it is already
a participant.
CiTech, BANGALORE
Ring-based election algorithm
• On forwarding an election message in any case, the process marks
itself as a participant.
• If, the received identifier is that of the receiver itself, then this
process’s identifier must be the greatest, and it becomes the
coordinator.
• The coordinator marks itself as a non-participant once more and
sends an elected message to its neighbor, announcing its election
and enclosing its identity.
CiTech, BANGALORE
CiTech, BANGALORE
The bully algorithm
CiTech, BANGALORE
The bully algorithm
CiTech, BANGALORE
The bully algorithm
• The process that knows it has the highest identifier can elect itself
as the coordinator simply by sending a coordinator message to all
processes with lower identifiers.
• a process with a lower identifier can begin an election by sending
an election message to those processes that have a higher identifier
and awaiting answer messages in response.
• If none arrives within time T, the process considers itself the
coordinator and sends a coordinator message to all processes with
lower identifiers announcing this.
• Otherwise, the process waits a further period Tc for a coordinator
message to arrive from the new coordinator. If none arrives, it
begins another election.
The bully algorithm
CiTech, BANGALORE