# Sequential Consistency
1. 事件历史在各个进程上看全局一致
- 即各个进程看到的顺序一样,比如两个并发写,各个进程读到的顺序要一样
2. 单个进程的事件历史在全局历史上符合程序顺序[program order](https://danielw.cn/program-order-in-distributed-systems)
- 多个进程按照各个进程原来的顺序穿插排序
# Linearizability
- 也称为强一致性,包含了 Sequential Consistency 的约束。
- **当事件之间没有重叠**, Linearizability 必须给出明确的先后顺序。
- 需要维持不同进程无重叠事件原来的顺序。
- 比如写完 x,后续读取都要反应出最新的值。
- Sequential Consistency 只要求维持单进程原来的顺序。
- Linearizability要求不管是不是并行的事件, 所有进程都必须给出一致的事件顺序, 这样所有进程都会对事件历史有完全同样的线性观点, 这就像是一个消除并行的过程, 所叫我们称之为做Linearization. 一个历史可以有多种Linearziation。
> [!tip] 对比
> Linearizabilty is based on physical time ordering. Sequential consistency is based on logical time ordering. In both models, as long as we can come up with one ordering, where we show that we’re definitely returning the most recent write, we’re fine. In linearizability, that’s physical time ordering. In sequential consistency, that’s logical ordering.
- Sequential 需要物理执行顺序满足单进程 program order 带来的偏序关系;
- it allows writes from other processes to show up later。
- Linearizability 需要物理执行顺序满足全序。有重叠事件可以有多种全序排列(任意均可)。
# Refs
- [Consistency Models by cuhk.edu.hk](https://mobitec.ie.cuhk.edu.hk/iems5730Spring2024/static_files/slides/ConsistencyModelsESTR4316Spring2024.pdf)
- [分布式系统一致性的发展历史](https://danielw.cn/history-of-distributed-systems-1)