分布式系统中的全局状态与逻辑时间
在分布式系统中,全局状态的计算和逻辑时间的概念是非常重要的。下面将详细介绍适用于非FIFO通道的全局状态算法,以及线性时间这种逻辑时间类型。
适用于非FIFO通道的全局状态算法
该算法用于计算分布式执行的一致全局状态,以下是相关代码:
internal operation record_ls() is
(1)
σi ←current local state of pi;
(2)
gs_statei ←red;
(3)
record σi, rec_msgi[c_ini], and sent_msgi[c_outi];
(4)
send the previous triple to cp.
when START() is received do
(5)
if (gs_statei = green) then record_ls() end if.
when MSG(m) is received on in_channeli[j] do
(6)
rec_msgi[j] ←rec_msgi[j] ∪{m};
(7)
if (m.color = red) ∧(gs_statei = green) then record_ls() end if;
(8)
pass MSG(m) to pi.
when MSG(m) is sent on out_channeli[j] do
(9)
m.color ←gs_statei;
(10) sent_msgi[k] ←sent_msgi[j] ∪{m}.
这个算法的工作流程如下:
1.
超级会员免费看
订阅专栏 解锁全文
6万+

被折叠的 条评论
为什么被折叠?



