100% found this document useful (1 vote)
389 views2 pages

Bully and Ring Election Algorithms

This document discusses election algorithms used in distributed systems to choose a coordinator process. It describes two election algorithms: the Bully algorithm, which is used when every process can communicate with every other process, and the Ring algorithm, used when processes are organized in a ring topology where each can only communicate with its neighbor. The Bully algorithm involves a process with the highest priority number being elected as coordinator if the current one fails, while the Ring algorithm passes an active process list around the ring to determine the highest priority number.

Uploaded by

devansh garg
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
389 views2 pages

Bully and Ring Election Algorithms

This document discusses election algorithms used in distributed systems to choose a coordinator process. It describes two election algorithms: the Bully algorithm, which is used when every process can communicate with every other process, and the Ring algorithm, used when processes are organized in a ring topology where each can only communicate with its neighbor. The Bully algorithm involves a process with the highest priority number being elected as coordinator if the current one fails, while the Ring algorithm passes an active process list around the ring to determine the highest priority number.

Uploaded by

devansh garg
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
  • Election algorithm and distributed processing

Election algorithm and distributed

processing
Distributed Algorithm is a algorithm that runs on a distributed system.
Distributed system is a collection of independent computers that do not
share their memory. Each processor has its own memory and they
communicate via communication networks. Communication in networks is
implemented in a process on one machine communicating with a process on
other machine. Many algorithms used in distributed system require a
coordinator that performs functions needed by other processes in the
system. Election algorithms are designed to choose a coordinator.
Election Algorithms:
Election algorithms choose a process from group of processors to act as a
coordinator. If the coordinator process crashes due to some reasons, then a
new coordinator is elected on other processor. Election algorithm basically
determines where a new copy of coordinator should be restarted.
Election algorithm assumes that every active process in the system has a
unique priority number. The process with highest priority will be chosen as a
new coordinator. Hence, when a coordinator fails, this algorithm elects that
active process which has highest priority [Link] this number is send
to every active process in the distributed system.
We have two election algorithms for two different configurations of distributed
system.
1. The Bully Algorithm –
This algorithm applies to system where every process can send a message
to every other process in the system.
Algorithm – Suppose process P sends a message to the coordinator.
1. If coordinator does not respond to it within a time interval T, then it is
assumed that coordinator has failed.
2. Now process P sends election message to every process with high
priority number.
3. It waits for responses, if no one responds for time interval T then process
P elects itself as a coordinator.
4. Then it sends a message to all lower priority number processes that it is
elected as their new coordinator.
5. However, if an answer is received within time T from any other process Q,
 (I) Process P again waits for time interval T’ to receive another
message from Q that it has been elected as coordinator.
 (II) If Q doesn’t responds within time interval T’ then it is assumed to
have failed and algorithm is restarted.
2. The Ring Algorithm –
This algorithm applies to systems organized as a ring(logically or physically).
In this algorithm we assume that the link between the process are
unidirectional and every process can message to the process on its right
only. Data structure that this algorithm uses is active list, a list that has
priority number of all active processes in the system.
Algorithm –
1. If process P1 detects a coordinator failure, it creates new active list which
is empty initially. It sends election message to its neighbour on right and
adds number 1 to its active list.
2. If process P2 receives message elect from processes on left, it responds
in 3 ways:
 (I) If message received does not contain 1 in active list then P1 adds 2
to its active list and forwards the message.
 (II) If this is the first election message it has received or sent, P1
creates new active list with numbers 1 and 2. It then sends election
message 1 followed by 2.
 (III) If Process P1 receives its own election message 1 then active list
for P1 now contains numbers of all the active processes in the system.
Now Process P1 detects highest priority number from list and elects it
as the new coordinator.

Common questions

Powered by AI

In the Bully Algorithm, if a process detects the coordinator’s failure by not receiving a response within a time interval T, it sends an election message to all processes with higher priority numbers. If no higher-priority processes respond within time T, the detecting process elects itself as the new coordinator and informs lower-priority processes. If a higher-priority process responds within time T, the detecting process waits for confirmation that this process has become the coordinator. If no confirmation arrives, the process assumes that the coordinator has also failed and restarts the election .

In a distributed system using election algorithms, each processor communicates with others through a network. Communication involves sending messages between processes on different machines; for example, the Bully Algorithm assumes all processes can directly message each other, whereas the Ring Algorithm assumes unidirectional communication where each process can only message its direct neighbor. These communications help determine and elect a new coordinator when the existing one fails .

Efficiently assigned priority numbers directly impact the decision-making speed in both the Bully and Ring Algorithms. In the Bully Algorithm, higher-priority processes quickly self-nominate or confirm their status, potentially reducing election time if few processes hold higher priorities. In the Ring Algorithm, well-distributed priorities ensure rapid acknowledgment, as lower priorities do not obstruct the cyclic determination of the coordinator, allowing swift construction of the active list and decision-making .

Election algorithms assume that every active process in the system has a unique priority number, which determines its role in becoming a coordinator. Communication assumptions vary by algorithm: the Bully Algorithm presumes any process can message all others directly, while the Ring Algorithm works with unidirectional communication and logical or physical ring connections, meaning each process can only message its immediate neighbour .

To optimize election algorithms in high-latency networks, strategies such as adaptive timeout settings could help minimize unnecessary waits between message acknowledgments, thereby improving response and election times. Utilizing more frequent heartbeat messages can detect failures more accurately in the Bully Algorithm. For the Ring Algorithm, enhancing message redundancy or route assurance by dynamically adjusting how processes forward messages can ensure robustness across unreliable or variable connectivity conditions .

The unidirectional communication in the Ring Algorithm ensures that processes only interact with their immediate clockwise neighbor, reducing the complexity of message handling by avoiding multi-directional noise and contention. However, this constraint means the algorithm is sensitive to any single link failure, as it could block the election process indefinitely unless each message continues on a well-defined path and confirms once the ring is completed, which ensures each active process's number is considered .

In the Bully Algorithm, if the process presumed to be the new coordinator fails during the election (i.e., it stops responding), the election process is restarted, with other high-priority processes possibly declaring themselves as the coordinator. In contrast, the Ring Algorithm relies on a fixed sequence of message passing; if any process stops responding, the algorithm inherently handles this through the redundancy of message forwarding, continuing until the original process detects the complete cycle, ensuring a new coordinator is eventually selected .

In the Ring Algorithm, the active list is a data structure that accumulates the priority numbers of all active processes in the system. When a process detects a coordinator failure, it creates a new active list and sends an election message to its right neighbour, appending its own number. Each process that receives the message checks the list, appends its number if absent, and passes it along. When a process sees its own number again, it knows the list includes all active processes, from which it selects the one with the highest priority as the new coordinator .

The Ring Algorithm can be more advantageous in systems with unidirectional communication links where processes are arranged in a logical or physical ring. It is beneficial when system resources are limited since it requires fewer messages overall—each process communicates only with its neighbour, reducing communication overhead compared to the Bully Algorithm, which requires broadcasting messages to all other processes. Additionally, its simplicity makes the Ring Algorithm easier to implement and manage in environments where link capabilities suit its design .

Implementing the Bully Algorithm in systems with mixed priority numbers can introduce challenges in consistency and fairness. Variations in processing delays, uneven distribution of priority numbers, and network partitions can lead to repeated or stuck elections, as lower-priority processes may incorrectly assume the coordinator role if more logical processes sporadically respond. Also, ensuring processes accurately detect and relay failures without mistaking transient network issues demands robust failure detection measures .

Election algorithm and distributed 
processing
Distributed Algorithm is a algorithm that runs on a distributed system. 
Distr
unidirectional and every process can message to the process on its right 
only. Data structure that this algorithm uses is ac

You might also like