关于Localized Causal Broadcast
coconutnut

DA project submission #2 要求实现Localized Causal Broadcast,具体的定义在project repo的README中

  • You must implement this on top of uniform reliable broadcast (URB).
  • The CONFIG command-line argument for this algorithm consists of a file that contains an integer m in its first line. m defines how many messages each process should broadcast.
  • For a system of n processes, there are n more lines in the CONFIG file. Each line i corresponds to process i, and such a line indicates the identities of other processes which can affect process i. See the example below.
    • The FIFO property still needs to be maintained by localized causal broadcast. That is, messages broadcast by the same process must not be delivered in a different order then they were broadcast.
    • The output format for localized causal broadcast remains the same as before.
      Example of CONFIG file for a system of 5 processes, where each one broadcasts m messages:
1
2
3
4
5
6
m
1 4 5
2 1
3 1 2
4
5 3 4

Note: Lines should end in \n, and numbers are separated by white-space characters.

In this example we specify that process 1 is affected by messages broadcast by processes 4 and 5. Similarly, we specify that process 2 is only affected by process 1. Process 4 is not affected by any other processes. Process 5 is affected by processes 3 and 4.

We say that a process x is affected by a process z if all the messages which process z broadcasts and which process x delivers become dependencies for all future messages broadcast by process x. We call these dependencies localized. If a process is not affected by any other process, messages it broadcasts only depend on its previously broadcast messages (due to the FIFO property).

Note: In the default causal broadcast (this algorithm will be discussed in one of the lectures) each process affects all processes. In this algorithm we can selectively define which process affects some other process.

关于dependency

process is affected by other processes,但消息的dependency是对每一条消息而言的。

(当用书上的vector clock方法实现时)也就是说,每一条LCB层消息在broadcast的时间点,需要拿到这个时间点、当前进程的vector clock,作为自己的dependency clock。可以作为消息内容传给其它process。

其它process收到消息,判断能否deliver,即判断自己的vector clock是否大于消息的dependency clock。

关于FIFO

根据sequence number可以保证FIFO。

基于vector clock也可以保证FIFO。

对于其它进程,都是在deliver消息时,增加该进程对应的vector clock值。

对于当前进程,可以做一些调整,在broadcast消息时就修改对应的vector clock值。

🌰:

1
2
3
# in process 1
b 1 [0 . .]
b 2 [1 . .]

那么其它进程收到2时,必须先deliver 1。

可以保证当前进程广播的每一条消息,都有不同的vector clock(即使当前进程没有affected by任何进程),从而保证FIFO。

这样在deliver的时候,可以统一处理vector clock,而不用管sequence number。