Thursday 10 September 2009

Distributed Systems - Bully Algorithm

Let’s assume that we have 7 nodes:

ini7

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:



ele1

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:

ele2

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’:

ele3

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

ele4

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:

elefin

No comments:

Post a Comment