Skip to content
We areTOP 1%

What is serializability, and how do you check whether a schedule is conflict serializable?

HardConceptTransactions & ACID
Track your progress
First attempt
Re-solve after a few days
Final pass before interviews

Answer

A schedule is the order in which the operations of concurrent transactions are interleaved. A schedule is serializable if its effect equals that of some serial schedule, in which the transactions run one after another.

  • Two operations conflict if they belong to different transactions, access the same item, and at least one of them is a write.
  • A schedule is conflict serializable if swapping adjacent non-conflicting operations can turn it into a serial schedule.
  • Test: draw a precedence graph with one node per transaction and an edge Ti → Tj whenever an operation of Ti conflicts with a later operation of Tj. The schedule is conflict serializable if and only if the graph has no cycle; a topological order of the graph gives the equivalent serial order.
  • View serializability is a broader condition, but testing it is NP-complete.

Example:

time:  1      2      3
T1:    R(A)          W(A)
T2:           W(A)

T1 reads A before T2 writes it (edge T1 → T2), and T2 writes A before T1 writes it (edge T2 → T1). The graph has a cycle, so the schedule is not conflict serializable.

More in Transactions & ACID

Sign in to track your progress

Your checkboxes, streak and activity heatmap are saved to your account and sync across devices. It is free.
Sign in with email

New here? Create an account