形式陈述
Lamport 逻辑时钟为每个事件
其中
以
直觉
逻辑时钟不测量物理秒数,而是给因果先后安排一致的编号。若一个事件可能影响另一个事件,编号必须递增;彼此无关的事件也可能恰有不同编号。
例子与边界
推论与应用
Lamport 时钟用于因果一致的事件排序、分布式互斥与日志重放。它提供 happens-before 的保序嵌入;需要精确恢复因果偏序时,应使用向量时钟等更丰富结构。
参考资料
- Nancy A. Lynch, Distributed Algorithms, Morgan Kaufmann, 1996,Ch. 6。
- Leslie Lamport, “Time, Clocks, and the Ordering of Events in a Distributed System,” Communications of the ACM 21(7), 1978,Full paper, §§1–3。