Distributed Systems – Bully Algorithm

Let’s assume that we have 7 nodes:


At this current moment in time, node ‘7’ is the coordinator, because it is the highest numbered node. But then node ‘7’ leaves, so who is now the coordinator? Lets say node ‘4’ decides it wants to be the coordinator, then we have:


Here, node ‘4’ has sent a ELECTION to nodes ‘5’, ‘6’ and ‘7’, this is because none of the nodes know that node ‘7’ has left yet. In this case, node ‘7’ cannot reply, yet, nodes ‘5’, and ‘6’ are still here, so they reply to ‘4’ that they are still here:


Now we have nodes ‘5’ and ‘6’ sending out elections. In this case, node ‘5’ sends an election to node ‘6’ and ‘7’. Whereas node ‘6’ just sends an election to node ‘7’:


Now, since node ‘6’ is still here, then node ‘6’ tells node ‘5’ that it is still here:


Finally, since node ‘7’ has not replied to node ‘6’, this implies that node ‘7’ no longer exists, meaning that node ‘6’ is the new coordinator. So node ‘6’ tells all the other nodes:



About Badgerati
Computer Scientist, Games Developer, and DevOps Engineer. Fantasy and Sci-fi book lover, also founder of Cadaeic Studios.

2 Responses to Distributed Systems – Bully Algorithm

  1. inayat says:

    It was quite simple and interesting. I am working on this task to give an optimized way of this algorithm, but I think it is a best example for the total beginners.

  2. Jigsaw says:

    Thanks! Came after after the wiki article failed to convince me.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: