Bully Algorithm
Bully Algorithm
1) Bully Algorithm
2) Ring Algorithm
3) Raft Consensus Algorithm
4) Ricart’s Agarwala’s Algorithm
5) Lamport’s Algorithm
Bully Algorithm
Bully Algorithm starts its process of selecting of coordinator when a working
process notices that the coordinator is not responding to it and then initiates
an election. The selection of a coordinator sends an election message to all the
other available processes.
If none of the process responds to its message the process itself wins the
election and becomes the coordinator.
Meanwhile, if any process that has a higher ID than the initiating process
answers, it takes charge of initiating the process.
In this algorithm, the bully guy that is the participating process that has
the highest ID becomes the coordinator. This approach is efficient in
terms of fault tolerance but complex to implement.
Ring Algorithm
Ring Algorithm starts its process of selecting of coordinator once any process
connected in the ring notices that the coordinator is not functioning. The
initiating process then prepares an election message that contains its own
process number and then sends this message to its successor in the ring. If the
successor is not functioning then it kills that successor and sends it to the next
one.
Every next process then adds its process number to the message and
delivers the message to the next process connected in the ring.
It continues until the message again reaches the initiating process.
Now the message consists of the process number of all the functioning
processes.
The process that has the highest ID wins the election. The initiating process
then sends another message in the ring about the winning process.
Ring Algorithm
Raft Consensus Algorithm
The Raft Consensus Algorithm is a leader-based protocol used in distributed
systems to ensure that all nodes within a cluster agree on a single state of data,
even in the event of node failures.
By electing a designated leader who manages the replication of logs across all
nodes and makes decisions on behalf of the cluster; essentially, it allows a
group of computers to reach consensus on a value by electing a leader to
coordinate the decision-making process.
Making it a reliable way to manage data consistency in distributed systems.
Algorithm:
To enter Critical section:
o When a site Si wants to enter the critical
section, it send a
timestamped REQUEST message to all
other sites.
In this algorithm:
Three type of messages ( REQUEST, REPLY and RELEASE)
are used and communication channels are assumed to
follow FIFO order.
A site send a REQUEST message to all other site to get their
permission to enter critical section.
A site send a REPLY message to requesting site to give its
permission to enter the critical section.
A site send a RELEASE message to all other site upon
exiting the critical section.
Every site Si, keeps a queue to store critical section requests
ordered by their timestamps. request_queuei denotes the
queue of site Si
A timestamp is given to each critical section request using
Lamport’s logical clock.
FAQs:
How does Lamport’s algorithm ensure mutual
exclusion in a distributed system?