Question

So, I am reading about the Bully algorithm and other similar algorithms, and it's pretty easy, but one thing I don't understand, why do we need a coordinator at the first place? What does process do once he gets to be a coordinator? Any real-world examples would be great, in C, or Java, or just words.

Was it helpful?

Solution

Exactly what the coordinator does is up to you. This is a little like looking at a sorting algorithm and asking "but why do I want the data sorted?" The sorting algorithm really doesn't care why -- it's just taken for granted that if you're going to use a sorting algorithm, you have some reason for the data to be sorted.

Likewise, the basic assumption of the Bully algorithm is that you started out needing some way for a distributed system to elect some sort of coordinator.

Just for example, let's assume you have a distributed file system. To keep things simple, it's going to be sort of a master/slave system: anytime a file is changed, some record of the change (diffs, whole file, whatever) the machine were the change takes place sends it to the master. The master then ensures the change is propagated through the whole system.

For this, you need to pick a machine to act as the master. You don't necessarily care all that much which, but you have to ensure that all the machines agree on which one it'll be. The Bully algorithm can do that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top