◄ WORLD II · THE FOLDTHE OCHO · blue builds │ the machine │ red breaks

THE SERIALIZABILITY

An interleaved schedule is correct when it behaves as if the transactions ran one at a time. Build the precedence graph — an edge Ti→Tj whenever an operation of Ti conflicts with and precedes one of Tj on the same item — and the schedule is serializable exactly when that graph is acyclic. Down the center a schedule of reads and writes goes in, the engine builds the graph, the verdict comes out. The blue team builds and defends it; the red team tries to break it.

source Eswaran, Gray, Lorie & Traiger, The Notions of Consistency and Predicate Locks in a Database System (1976), CACM 19(11):624–633 — dl.acm.org/doi/10.1145/360363.360369. Rendered, not quoted.

◧ blue team · builds & defends
3

THE MODEL — the precedence graph

Serializability is not guessed; it falls out of a directed graph:

nodes are the transactions. edge Ti→Tj is drawn whenever an operation of Ti conflicts with and precedes an operation of Tj on the same item. verdict: the schedule is conflict-serializable if and only if this graph has no cycle — a topological sort of an acyclic graph is a serial order the schedule is conflict-equivalent to.

Edges of the current schedule:

fromtovia item
5

THE LINEAGE — 2PL AVAN

Acyclicity is the gold standard: a schedule as correct as running each transaction alone. But a graph test only judges a finished schedule. To guarantee acyclicity while transactions still run, you need a protocol.

That protocol is two-phase locking — grow all locks, then release, never re-acquire. Its theorem: every 2PL schedule is conflict-serializable, i.e. its precedence graph is provably acyclic. This sphere proves the property; the neighbour enforces it. Each sphere is the next one's premise.

7

THE WITNESS live

The blue team's live check: for every schedule below, compare the graph verdict (acyclic?) against the ground truth (exhaustive search over all t! serial orders). If red tampers, this badge is where it shows.

▼ the machine ▼
4

DATA IN — the schedule in ↓

A schedule is an interleaving of the operations of several transactions on shared data items. Each operation is a read or a write of one item, tagged by its transaction. Two operations conflict only if they touch the same item, belong to different transactions, and at least one is a write:

pairsame itemconflict?
read / readyesno
read / writeyesRW — yes
write / readyesWR — yes
write / writeyesWW — yes

Order matters: the earlier operation of a conflicting pair points to the later one. That single arrow is what you feed the panel below.

▼   feed the schedule into the engine   ▼
0

▣ THE PANEL — the engine LIT

Pick any schedule — the graph is built and the cycle test is run on the spot, never looked up. The serial order (when it exists) is a live topological sort.

▼   the engine emits a verdict   ▼
8

DATA OUT — the result out ↓

What the machine produces, proven: for every constructed schedule the graph verdict equals the ground truth conflict-serializable ⟺ acyclic, checked exhaustively against all t! serial orders. A purely serial schedule is a chain; the classic lost-update interleaving is a cycle and is rejected; a write-write-only cycle is caught by the WW edge.

The blue team's witness (left) confirms these live; the red team (right) tries to make the graph lie.

red team · attacks & breaks ◨
1

THE ADVERSARY

WALL Conflict-serializability is strictly narrower than correctness. It is a sufficient, not necessary, condition: some schedules with blind writes are view-serializable — equivalent to a serial order on final state — yet have a cyclic conflict graph, and this engine rejects them. CSR ⊊ VSR.

The trade is deliberate: deciding view-serializability is NP-complete, while the cycle test is linear. The database picks the cheap, conservative test and refuses some legal schedules on purpose. "Serializable" here means conflict-serializable — one honest choice among several.

2

THE GRAVEYARD

"Serializable means the operations do not interleave." Cut. Heavy interleaving is fine — serializable means conflict-equivalent to some serial order, not run without overlap.

"A cycle-free graph means no deadlock." Cut. Wrong graph. Precedence-graph acyclicity is about serializing a completed schedule; deadlock is a cycle in the wait-for graph.

"Two writes to the same item do not conflict if they store the same value." Cut. WW conflict is defined by operation and order, not value — dropping it is exactly the red team's tamper (window 6).

6

THE TAMPER — break it

The red team's move: stop tracking write-write edges — keep only read-write ones. A schedule whose only cycle rides a WW edge now looks acyclic, and the engine wrongly calls it serializable. The witness (window 7) is watching.

Drop the write-write edge and the write-write cycle vanishes — the graph goes acyclic, the verdict flips to serializable, but the exhaustive ground truth still says non-serializable. The witness recomputes, disagrees, and turns red. Nothing is faked; the attack is real and it is caught.