Open In App

Difference Between Ring and Bully Algorithm

Last Updated : 08 Apr, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Election algorithms are required in order to select the coordinator. A distributed algorithm consists of many working processes. These distributed algorithms require a process that acts like a coordinator. This coordinator can be any of the working processes that organize the actions. When a coordinator fails the election algorithms are required to find the coordinating process.

Election Algorithms have two assumptions such as:

  1. Each process that is involved has a unique identification number.
  2. Each process knows the identification number of every other process.

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 own 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

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.

Bully-min

Difference between Ring and Bully Algorithm

Parameter

Ring Algorithm

Bully Algorithm

Communication Strategy

In a ring algorithm communication between the processes takes place in the logical ring structure.

In the bully algorithm, direct communication takes place between all the processes.

Process of Election

The process of election takes place by passing a message along the ring.

The process of election takes place by directly messaging the processes with higher process ID

Selection of new Coordinator

In the ring algorithm, the process that has the highest ID in the ring becomes the new Coordinator.

In the bully algorithm, the process that has the highest ID among the responding processes becomes the new Coordinator

Response Mechanism

In the ring algorithm, the message is being forwarded or it responds with a higher ID.

In the bully algorithm, one process responds to another by sending an “OK” message

Complexity

The ring algorithm is less complex.

The bully algorithm is more complex than the ring algorithm.

Scalability

The ring algorithm is more scalable when the number of processes is small.

The bully algorithm can work well when the number of processes is more.

Fault Tolerance

The ring algorithm can be affected when the ring is broken. As there will be no complete message passing and communication between the processes.

The bully algorithm can handle such faults as the communication takes place directly between two different available processes

Utilization of Resources

The ring algorithm requires fewer resources for communication because the messages are being shared among the processes connected in the ring.

Bully Algorithm increases the communication overhead because the messages are being sent directly from one process to another.

Conclusion

Election Algorithms such as ring and Bully algorithm plays a very vital role while selecting a coordinating process among all the available processes. This coordinator process is responsible for the proper functioning and execution of the operation. Comparing both the Algorithms the approaches are different but the ring algorithm is less complex as compared to the bully algorithm whereas the bully algorithm is efficient for fault tolerance as the communication takes place from one process to another.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads