简体   繁体   English

分布式计算中的LCR vs Floodmax(领导者选举)

[英]LCR vs Floodmax in distributed computing (Leader Election)

I am trying to understand the practical difference between LCR and Floodmax within the context of synchronous networks. 我试图了解同步网络中LCR和Floodmax之间的实际区别。

I understand that Floodmax has a time complexity of O(N) and in essence works as follows: 我了解Floodmax的时间复杂度为O(N),并且本质上如下工作:

  • Every process keeps the maximum UID it has seen so far (initially its own). 每个进程都将保持到目前为止已看到的最大UID(最初是自己的UID)。
  • At each round, each process sends this maximum value to every outgoing neighbor. 在每个回合中,每个进程都会将此最大值发送给每个传出邻居。
  • After diam rounds if the maximum value is the process's UID then it elects itself the leader, otherwise it is a non-leader. 如果最大值是进程的UID,则在进行diam取整之后,它将选举自己为领导者,否则为非领导者。

LCR on the other hand: 另一方面,LCR:

  • Each process sends its UID around the ring. 每个进程在环周围发送其UID。 When a process receives a UID, it compares this one to its own. 进程收到UID时,会将其与其自身进行比较。
  • If the incoming UID is greater, then it passes this UID to the next process. 如果传入的UID较大,则它将此UID传递到下一个进程。
  • If the incoming UID is smaller, then it discards it. 如果传入的UID较小,则将其丢弃。
  • If it is equal, then the process declares itself the leader. 如果相等,则过程将自己声明为领导者。

It too has a time complexity of O(N). 它的时间复杂度也为O(N)。 So, in essence, both algorithms pass around UIDs in a token-ring network. 因此,从本质上讲,两种算法都在令牌环网络中绕过UID。 Is there any real difference or advantage between the two? 两者之间有什么真正的区别或优势?

As the name implies, the FloodMax algorithm "floods" the network with messages. 顾名思义,FloodMax算法会将消息“淹没”网络。 Unlike LCR, FloodMax will work even if the network topology is not a ring. 与LCR不同,即使网络拓扑不是环形,FloodMax也可以使用。 A pre-requisite for the FloodMax algorithm is that the network diameter must be known (with LCR this is not the case) and has a time complexity of diameter-rounds. FloodMax算法的先决条件是必须知道网络直径(使用LCR则不是这样),并且网络直径具有时间复杂度。 LCR on the other hand does not require the network diameter to be known: because of this it requires additional communication overhead as the leader needs to notify all other processes to terminate once it has elected itself. 另一方面,LCR不需要知道网络直径:因此,它需要额外的通信开销,因为领导者一旦选举出自己就需要通知所有其他进程终止。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM