选举算法 - 环算法

Election Algorithms - A ring algorithm

我一直在阅读分布式系统中的选举算法。我阅读了 Bully Algorithm 并理解了它。我遇到了 A Ring Algorithm,了解了它是如何进行选举的,但我不明白它是如何处理两个进程 25 同时发现协调器 7没有运行。

Each of these builds an ELECTION message and start circulating it.Eventually, both messages will go all the way around,and both 2 and 5 will convert them to COORDINATOR message, with exactly the same number and in the same order.

谁将成为协调者(25),为什么根据这个算法?

说2和5发现coordinator不工作了,那么都会发起选举算法。

由于环是单向的,消息只能在一个方向上传播。 2的选举消息将到达5,5的选举消息将到达2。

但有趣的一点是,每当一个节点收到选举消息时,它会将自己的 id 附加到 message.Also 当一个节点收到自己的选举消息时,它会选择 id 最大的节点作为new coordinator 在两个选举消息中都是 5.

因此5将成为协调者并发送协调者消息。