skip to content

Sequential consistency guarantees a single global order of operations that all processes agree on, but unlike linearizability it doesn't require that order to respect real-time (wall-clock) ordering across processes. Why would a system designer choose sequential consistency over linearizability, and what real-time anomaly does that trade-off allow?

level: seniorimportance: nice to knowfreq 30%

answer

  1. total order required, but no real-time constraint
  2. Lamport 1979 - defined for multiprocessor memory
  3. still needs global agreement on write order
  4. reads or writes local, never both
  5. anomaly: a completed write can still be invisible to a later real-time read

basics

~20 s

Sequential consistency can be cheaper than linearizability: its one agreed order need not match real time, so reads or writes, not both, can be served locally. The catch: a read starting after a write finished may still miss it.

solid answer

~50 s

Linearizability requires that if operation A completes in real time before operation B starts, every observer must see A before B, which forces coordination like waiting for consensus or quorum acknowledgment, adding latency especially across geo-distributed replicas. Sequential consistency drops the real-time requirement: it only requires that there exists some total order of all operations consistent with each process's own program order, and that all processes see that same total order - but that order doesn't have to match wall-clock time. This lets an implementation reorder or delay operations relative to real time as long as it stays internally consistent. The anomaly this permits: process P1 finishes write W at time T1, process P2 starts a read at T2 after T1, yet P2 can still legitimately see the pre-W value, because sequential consistency never promised that something over in real time must be visible - only that everyone agrees on one consistent ordering.

go deeper

for a junior

Not expected to have depth here; can be asked informally whether 'agreed order' and 'real time order' sound like the same thing.

for a middle

Should know the basic definition of sequential consistency, a single agreed order that keeps each process's program order, but may not yet know which part of the coordination cost it removes.

for a senior

Should explain the real-time vs total-order distinction precisely, name the stale read it permits, and say that fitting every read and write into one order that keeps program order still leaves reads or writes paying a network delay.

for a principal

Should weigh whether sequential consistency's saving, one kind of operation made local, matters for the workload, and choose between it, linearizable and causal or eventual models on actual latency and business requirements.

## The definition Sequential consistency, introduced by **Leslie Lamport** in 1979 in the context of multiprocessor memory models, requires that there exist some single total order of all operations issued by all processes, such that: 1. every process's own operations appear in that order in the same sequence it issued them, and 2. every process observes operations happening in that same total order. Crucially, unlike linearizability, sequential consistency drops any requirement that this total order respect real, wall-clock time. **Linearizability additionally demands**: if operation A completes in real time before operation B begins, then A must appear before B in the order every observer sees. Sequential consistency has no such rule; it only requires internal consistency, one agreed order respecting each process's own sequence, not alignment with an external clock. ## What an implementation is allowed to do Mechanically, this distinction changes what an implementation is allowed to do. - **A linearizable system** must ensure that once a write is acknowledged complete, no subsequent read in real time from any process can return an older value, which typically forces real-time-respecting synchronization such as waiting for a quorum acknowledgment or routing operations through a leader with a fresh lease. - **A sequentially consistent system** is free to reorder or delay how it makes operations visible relative to real time, as long as it maintains one globally agreed story that respects each individual process's own local ordering — for instance it could batch and reorder writes for efficiency, or use loosely synchronized clocks, as long as the final total order it presents to every observer is internally coherent. ## Why a designer reaches for it, and what it still costs The reason a designer might reach for sequential consistency is that dropping the real-time constraint lets an implementation answer some operations from local state. A 1994 comparison of the two conditions by worst-case response time made this precise for replicated read/write objects: when clocks are only approximately synchronized, a linearizable implementation must make both reads and writes wait on the uncertainty in message delay, while a sequentially consistent one can answer reads instantly from a local copy, or writes instantly, but not both. The other operation still pays for agreement on one order of all writes, which implementations get through an atomic broadcast, a global sequencer, or a single serializing leader, so its latency includes the network. With perfectly synchronized clocks the same analysis finds the two conditions equally costly. ## The anomaly it permits The concrete anomaly sequential consistency permits, that linearizability forbids, is this: 1. process `P1` finishes write `W` in real time at `T1`; 2. process `P2`, whose read starts at `T2` strictly after `T1`, is still allowed to see the value from before `W`, as long as the overall order the system settles on remains internally coherent. Sequential consistency only promised a coherent story, not a promise that if it's over, it's visible. ## The trade-off The trade-off, then, is subtle and worth stating precisely: sequential consistency buys a weaker guarantee, no real-time ordering, and in return lets one kind of operation, reads or writes, skip the network, while the other still pays for global agreement on the order of writes. Designers who want coordination removed from both reads and writes go further down the spectrum to causal consistency, which drops the requirement to order unrelated operations at all, or all the way to eventual consistency. ## Where it fits, and where it does not - **A mistaken expectation.** A team that moves from a linearizable configuration to a sequentially consistent one expecting every operation to get faster will see the gain only on the operations the design made local: the other side still waits for one agreed order of writes, through a sequencer, a leader, or an atomic broadcast. - **Where it lives today.** Sequential consistency was defined for multiprocessors, yet real multiprocessors typically do not provide it: it rules out common hardware optimizations, such as write buffers that let a later read bypass an earlier write, so processors implement more relaxed memory models instead. Language memory models use it as a promise: a program free of data races behaves as if it ran on sequentially consistent memory. It is a model born out of hardware memory ordering, and today it is a promise language memory models make to race-free programs rather than a property mainstream hardware provides.

  • Since sequential consistency still requires a single global total order agreed on by everyone, what does dropping the real-time constraint actually save?
    It saves the wait that real-time ordering imposes: with clocks only approximately synchronized, a linearizable store makes both reads and writes wait on message-delay uncertainty, while a sequentially consistent one can serve reads, or writes, from local state. It cannot make both local: if two processes each wrote one object and read another locally, each could miss the other's write, an outcome no single order explains, so the other operation waits on the network, typically for an atomic broadcast or a sequencer.
  • Where does sequential consistency actually get used in practice?
    It was defined for multiprocessors, but real multiprocessors typically relax it, because it rules out optimizations such as write buffers that let a later read bypass an earlier write. Programmers meet it instead through language memory models, which promise that a program free of data races behaves as if it ran on sequentially consistent memory.
  • How would you explain to a team why picking sequential consistency for a globally-replicated database might not deliver the cost savings they expect?
    Every read and write must still fit one order that keeps each process's program order, so at most one kind of operation becomes local and the other keeps a cross-region delay, through a leader, an atomic broadcast or a sequencer. Teams should check which operations dominate their workload, since only the local ones get faster, and know that removing coordination from both reads and writes takes causal or eventual consistency.

Like a group of editors agreeing on a single, internally consistent chapter order for a book, even though that agreed order doesn't have to match the actual order the chapters were literally written in.

  • assumes sequential consistency is always meaningfully cheaper than linearizability in a distributed system
  • can't state that sequential consistency drops the real-time constraint but keeps the total-order requirement
  • confuses sequential consistency with serializability, a transaction isolation term
  • can't name a real anomaly sequential consistency permits that linearizability forbids

context