Skip to content
WebsiteHosting.com

comparison Backend & software

Linearizability versus serializability in histories

A read can fit a serial order yet contradict the timing of a completed write. Compare what order explains the values with what order the calls and responses allow.

Latest recorded source check · P0127

What it means

Linearizability asks whether each operation on an object can appear to take effect at one instant between its call and its response. Serializability asks whether the transactions, including the values they read, behave as if they ran one at a time in some order. The difference is in which orders count: serializability alone does not require that order to match the real-time order of nonoverlapping transactions.

Consider a write that finishes before a read starts. If the read returns the old value, putting the read first might explain that value. For linearizability, though, placing the read first is not an option: its call came after the write’s response.

Try it

Simulation: Start with Read/write history set to stale-after-write and Required scenario evidence set to provided. The numbers below mark calls and responses on a synthetic timeline, not measured delays. One object, x, starts at 0. Treat each operation as a one-operation transaction for the serializability comparison.

Linearizability versus serializability in histories

Contrast real-time ordering of operations with equivalence of transactional schedules

Simulation
Modeled outcome: Classified

Linearizability of the single-object history and serializability of the transaction history are tested only where defined.

Linearizability versus serializability in histories: synthetic scenario inputs
Replaces all inputs with the documented starting example and the indicated change. Reset restores the starting example.
History and admissible orders

Value-consistent order

  1. SerializableYes
  2. Legal serial ordersR → W

Real-time restriction

  1. Orders respecting real timeNone
  2. Single-object linearizabilityNo
W0–1 · Write x=1
R2–3 · Read x=0
03 positions

Intervals mark synthetic invocation and response positions. The two candidate serial orders are filtered by values first, then by real-time constraints. No time unit or database isolation behavior is measured.

Evaluated inputs

Required scenario evidence
provided
Read/write history
stale-after-write

Two-operation or two-transaction histories; enumerate both serial orders and reject read mismatch or reversed non-overlapping order. Single-object linearizability not asserted for multi-object transaction case; no general checker.

About this model

The controls set only a local, bounded scenario. The computed branch is not a verdict about a live system. Inputs listed as not evaluated did not participate in this branch after validation.

Reset restores the original inputs. It does not change the open or closed state of help or FAQ answers.

OperationCallResponseRecorded behavior
W: write01Sets x to 1
R: read23Returns 0

There are just two candidate orders. In W → R, the read would return 1, so that order cannot explain the recorded 0. In R → W, the read sees the initial 0, so the serializability test has a matching order. But W finished at 1 and R did not start until 2. Removing orders that contradict that timing leaves none. The default history is serializable but not linearizable.

Now select overlap. W runs from 0 to 3 and R from 1 to 2; the write and the returned value are unchanged. Compare the two lists of orders: R → W still explains the read, and now it also fits the timing. Although W starts first, it can appear to take effect after R reads 0 and before W responds. Both tests now have a matching order.

Select ordered for a different contrast with the default. The calls no longer overlap: W finishes at 1 and R starts at 2, just as in the first history. This time R returns 1. The matching order is W → R, and it respects real time. Reset returns to stale-after-write with evidence provided.

When the unit is a whole transaction

In cyclic-transactions, both x and y start at 0. Transaction A runs from 0 to 3, reads y = 0, and writes x = 1. Transaction B runs from 1 to 4, reads x = 0, and writes y = 1. To test serializability, keep each transaction’s read and write together:

  • Put A first, and B would read x = 1, not its recorded 0.
  • Put B first, and A would read y = 1, not its recorded 0.

Neither order explains both reads. Even though the transactions overlap, the history fails the serializability test before timing can rule anything out. The simulation gives no single-object linearizability verdict for this two-object case; that is different from a verdict of “not linearizable.”

The bars depict invocation and response positions, not operation durations in a unit such as milliseconds. In the overlapping case, the response from R comes before the response from W, but that alone would not prove R saw the old value. The recorded read result is needed to eliminate the alternative order. Read the value-consistent and real-time-consistent lists separately.

In practice

Choose the unit that matches your question. If you care whether a read of an object can return the old value after a write finishes, record the initial value, what each call did or returned, and whether the write’s response preceded the read’s call. The returned value alone cannot distinguish the first two histories. If you care whether whole transactions could have run one at a time, list their reads and writes together and look for one order that explains all the observations, not a different order for each read.

An empty list after checking both orders means neither order worked. Missing evidence means something else: with Required scenario evidence set to missing, the simulation does not examine the selected history at all. Its answer is unknown, not a failed consistency test.

These are fixed pairs of operations or transactions, not a general history checker or a test of a running database. For a particular history, name the unit, give the serial order that explains the reads if one exists, and say separately whether it respects completed-before-started calls. A matching order explains that history; it does not establish a guarantee for every history the system can produce.

Frequently asked questions

Editorial questions based on the listed sources and explicitly labeled local examples.

Can concurrent calls be reordered?

Yes, overlapping operations may be ordered differently if the resulting sequential history is legal and preserves nonoverlapping real-time order. That freedom is not permission to reorder completed-before-started calls.

Is serializability the same as strict serializability?

No; strict serializability also respects real-time order.

Does a stale read always violate serializability?

No. The old value can be legal if the read may precede the write in a serial order. When that write completed before the read began, a linearizable register cannot use such an order. The unit of the history and its real-time constraints matter.

What does the cycle show?

No serial order satisfies both dependencies.

Sources & model boundaries

Primary references used for this explanation. The interactive example is an educational model, not a live check.

  1. Herlihy and Wing: Linearizability

    definition. Legal sequential history must also preserve real-time order of nonoverlapping operations; pending histories require completion rules.

    Checked .

  2. PostgreSQL transaction isolation

    Serializable. Repeatable Read provides a stable view but does not guarantee a serial history; Serializable adds checks for executions that could violate serial equivalence.

    Checked .

Report an issue. Include the article URL and ID, not passwords or access keys.