notexOPENOverview
Notex/Systems/Linearizability Versus Serializability
11.03LESSON 03 OF 15 · 2 MIN READ

Linearizability Versus Serializability

Always free to read

Linearizability is easily confused with serializability (see “Serializability”), as both words seem to mean something like “can be arranged in a sequential order.” However, they are quite different guarantees, and it is important to distinguish between them:

Serializability

Serializability is an isolation level of transactions, where every transaction may read and write multiple objects (rows, documents, records). It guarantees that transactions behave the same as if they had executed in some serial order—that is, as if you first performed all of one transaction’s operations, then all of another transaction’s operations, and so on, without interleaving them. It is OK for that serial order to be different from the order in which the transactions were actually run.

Linearizability

Linearizability is a guarantee on reads and writes of a register (an individual object). It doesn’t group operations together into transactions, so it does not prevent problems such as write skew that involve multiple objects (see “Write Skew and Phantoms”). However, linearizability is a recency guarantee: it requires that if one operation finishes before another one starts, then the later operation must observe a state that is at least as new as the earlier operation. Serializability does not have that requirement—for example, stale reads are allowed by serializability.

Sequential consistency is something else again, but we won’t discuss it here.

A database may provide both serializability and linearizability; this combination is known as strict serializability or strong one-copy serializability (strong-1SR). Single-node databases are typically linearizable. With distributed databases using optimistic methods like SSI (see “Serializable Snapshot Isolation”), the situation is more complicated. For example, CockroachDB provides serializability and some recency guarantees on reads, but not strict serializability, because this would require expensive coordination between transactions. On the other hand, Spanner and FoundationDB offer strict serializability.

It is also possible to combine a weaker isolation level with linearizability, or a weaker consistency model with serializability; in fact, the consistency model and isolation level can be chosen largely independently from each other.

Progress is saved on this device.
KEEP EXPLORING

One note leads to another.

Back to the library →
⌕
Search across the entire library ⌘ K