http://muratbuffalo.blogspot.com/2025/05/chapter-2-serializability-theory.html Skip to main content Search This Blog [ ] [Search] Metadata On distributed systems broadly defined and other curiosities. The opinions on this site are my own. Chapter 2: Serializability Theory (Concurrency Control Book) * Get link * Facebook * X * Pinterest * Email * Other Apps - May 14, 2025 Chapter 2 of Concurrency Control and Recovery in Database Systems (1987) by Bernstein, Hadzilacos, and Goodman is a foundational treatment of serializability theory. It is precise, formal, yet simple and elegant, a rare combination for foundational theory in a systems domain. Databases got lucky here: serializability theory is both powerful and clean. The chapter builds up the theory step by step, introducing: 1. Histories 2. Serializable histories 3. The Serializability Theorem 4. Recoverability and its variants 5. Generalized operations beyond reads/writes 6. View equivalence Each section motivates definitions clearly, presents tight formalism, and illustrates ideas with well-chosen examples. 2.1 Histories This section lays the groundwork. It starts slow, and doesn't do anything fancy. It first defines what it means for the operations within a transaction to form a well-founded partial order. This intra-transaction ordering extends naturally to inter-transaction operations, forming a superset relation. Building on this, the book then defines a history as a partial order over operations from a set of transactions. Operations include reads (r1[x]), writes (w1[x]), commits (c1), and aborts (a1). Here the subscripts denote these operations all belong to transaction T1. A history models the interleaving of these operations from different transactions, respecting the per-transaction order and ensuring all conflicting operations are ordered. [Screenshot] The abstraction here is elegant. The model omits values, conditionals, assignments, anything not visible to the scheduler. Only the structure of dependencies matters. This minimalism is a strength: it gives just enough to reason about correctness. The section is also careful to handle incomplete histories (i.e., prefixes), which is crucial for modeling crashes and recovery. The discussion is very scheduler-centric. Since the scheduler is the component responsible for enforcing serializability, the model is tailored to what the scheduler can observe and act on. But this leads to missed opportunities as I mention below in Section 2.6 View equivalence. 2.2 Serializable Histories This is where things get real. The goal is to define when a concurrent execution (history) is "as good as" some serial execution. The section has a simple game plan: define equivalence between histories (conflict equivalence), define serial histories, and finally say a history is serializable if it is equivalent to some serial history. The chapter introduces the serialization graph (SG). Nodes are committed transactions. Edges capture conflicts: if T_i writes x before T_j reads or writes x, we add an edge T_i - T_j. [Screenshot] [Screenshot] The formalism is tight, but not heavy. A good example is Fig 2-1 (p. 30), which compares equivalent and non-equivalent histories. (Minor typo: second w1[x] in H3 should be w1[y].) Theorem 2.1 (Serializability Theorem): A history is serializable iff its serialization graph is acyclic. That's a beautiful punchline: serializability reduces to a cycle check in the conflict graph. Credit is where it is due. In this case it is Jim Gray again! At the end of the section there is an acknowledgment stating that: The definition of equivalence and serializability used here and the Serializability Theorem are from "Gray, J.N., Lorie, R.A., Putzulo, G.R., Traiger, I.L. Granularity of Locks and Degrees of Consistency in a Shared Database. Research Report, IBM, September, 1975." 2.3 The Serializability Theorem This section proves the big theorem about equivalence to a serial execution. Intuitively, if SG(H) is acyclic, we can topologically sort it into a serial history equivalent to H. And if SG(H) has a cycle, then H cannot be serialized. [Screenshot] The figure shows an example. Edges in SG(H) constrain any valid serial order. A cycle means contradictory constraints, and hence, no valid serial order. 2.4 Recoverable Histories Serializability ensures correctness in a crash-free world. But in practice, systems crash, transactions abort, and partial executions matter. To account for faults, this section defines increasingly strict notions: Recoverable (RC): If T_j reads from T_i, then T_i must commit before T_j. Avoids Cascading Aborts (ACA): T_j can only read from committed transactions. Strict (ST): Reads and overwrites can happen only after the previous writer commits or aborts. [Screenshot] Theorem 2.2: ST [?] ACA [?] RC [Screenshot] The inclusion hierarchy is illustrated in Fig 2-2. The intersection of these properties with SR defines realistic schedules that can tolerate failures and support recovery. Note that RC, ACA, and ST are prefix commit-closed properties, that is if they hold for history H, they also hold for any prefix of H. Nice and clean. 2.5 Operations Beyond Reads and Writes I was happy to see this section. The authors show how the theory generalizes to operations beyond reads and writes, as long as we redefine the notion of conflict appropriately. Two operations conflict if the order in which they execute affects: the final state of the database, or the values returned by operations. Fig. 2-3 gives the compatibility matrix to capture conflict relations between Read/Write/Inc/Dec. Increment(x) adds 1 to data item x and Decrement(x) subtracts 1 from x. An Inc or Dec does not return a value to the transaction that issues it. [Screenshot] The example history H11 shows how to construct SG(H) even with these new operations. The theory lifts cleanly. Since SG(H_11) is acyclic, the generalized Serializability Theorem says that H_11 is SR. It is equivalent to the serial history T1 T3 T2 T4 which can be obtained by topologically sorting SG(H_11). DAGs FTW! [Screenshot] Still, this is a limited discussion. It's not expressive enough to model more general commutativity. But the seeds of CRDTs are here. In CRDTs, you model operations based on whether they commute under all interleavings. There is an on-going research direction trying to build a nice theory around more general operations and monotonicity concepts. 2.6 View Equivalence This section introduces view serializability (VSR), a more permissive alternative to conflict serializability. Two histories are view equivalent if: * Every read in one history reads from the same write as in the other. * The final write to each data item is the same in both histories. VSR allows more schedules than CSR. Consider the example below. T3 overwriting both x and y saves the day and masks the conflicts in T1 and T2. Interesting special case! [Screenshot] The book says that testing for VSR is NP-complete, and that kills its usefulness for schedulers. The authors argue that all practical schedulers use conflict serializability, and view serializability is too expensive to enforce. Yet they acknowledge it's conceptually useful, especially for reasoning about multicopy databases (Chapters 5 and 8). Reading this section, I had an interesting question. Is view serializability the same as client-centric consistency? They seem very similar. Client-centric consistency, as discussed in Crooks et al., PODC 2017, defines correctness in terms of what reads observe. VSR is similarly observational. So while VSR wasn't practical for scheduling, it found a second life in defining observational consistency in distributed systems. I think there's more fruit on this tree. abstraction ConcurrencyControlBook transactions * Get link * Facebook * X * Pinterest * Email * Other Apps Comments Post a Comment Popular posts from this blog Hints for Distributed Systems Design - October 02, 2023 This is with apologies to Butler Lampson, who published the " Hints for computer system design " paper 40 years ago in SOSP'83. I don't claim to match that work of course. I just thought I could draft this post to organize my thinking about designing distributed systems and get feedback from others. I start with the same disclaimer Lampson gave. These hints are not novel, not foolproof recipes, not laws of design, not precisely formulated, and not always appropriate. They are just hints. They are context dependent, and some of them may be controversial. That being said, I have seen these hints successfully applied in distributed systems design throughout my 25 years in the field, starting from the theory of distributed systems (98-01), immersing into the practice of wireless sensor networks (01-11), and working on cloud computing systems both in the academia and industry ever since. These heuristic principles have been applied knowingly or unknowingly and has proven... Read more >> My Time at MIT - February 16, 2025 Image Twenty years ago, in 2004-2005, I spent a year at MIT's Computer Science department as a postdoc working with Professor Nancy Lynch. It was an extraordinary experience. Life at MIT felt like paradise, and leaving felt like being cast out. MIT Culture MIT's Stata Center was the best CS building in the world at the time. Designed by Frank Gehry, it was a striking abstract architecture masterpiece ( although like all abstractions it was a bit leaky ). Furniture from Herman Miller complemented this design. I remember seeing price tags of $400 on simple yellow chairs. The building buzzed with activity. Every two weeks, postdocs were invited to the faculty lunch on Thursdays, and alternating weeks we had group lunches. Free food seemed to materialize somewhere in the building almost daily, and the food trucks outside were also good. MIT thrived on constant research discussions, collaborations, and talks. Research talks were advertised on posters at the urinals, as a practical touch of M... Read more >> Making database systems usable - August 19, 2024 Image C. J. Date's Sigmod 1983 keynote, "Database Usability", was prescient. Usability is the most important thing to the customers. They care less about impressive benchmarks or clever algorithms, and more about whether they can operate and use a database efficiently to query, update, analyze, and persist their data with minimal headache. (BTW, does anyone have a link to the contents of this Sigmod'83 talk? There is no transcript around, except for this short abstract .) The paper we cover today is from Sigmod 2007. It takes on the database usability problem raised in that 1983 keynote head-on, and calls out that the king is still naked. Let's give some context for the year 2007. Yes, XML format was still popular then. The use-case in the paper is XQuery. The paper does not contain any reference to json. MongoDB would be released in 2009 with the document model; and that seems to be great timing for some of the usability pains mentioned in the paper! Web 2.0 was in ... Read more >> Looming Liability Machines (LLMs) - August 24, 2024 As part of our zoom reading group ( wow, 4.5 years old now ), we discussed a paper that uses LLMs for automatic root cause analysis (RCA) for cloud incidents. This was a pretty straightforward application of LLMs. The proposed system employs an LLM to match incoming incidents to incident handlers based on their alert types, predicts the incident's root cause category, and provides an explanatory narrative. The only customization is through prompt-engineering. Since this is a custom domain, I think a more principled and custom-designed machine learning system would be more appropriate rather than adopting LLMs. Anyways, the use of LLMs for RCAs spooked me vicerally. I couldn't find the exact words during the paper discussion, but I can articulate this better now. Let me explain. RCA is serious business Root cause analysis (RCA) is the process of identifying the underlying causes of a problem/incident, rather than just addressing its symptoms. One RCA heuristic is asking 5 Why... Read more >> Advice to the young - July 30, 2024 Image I notice I haven't written any advice posts recently. Here is a collection of my advice posts pre 2020. I've been feeling all this elderly wisdom pent up in me, ready to pour at any moment. So here it goes. Get ready to quench your thirst from my fount of wisdom. No man, think for yourself, only get what works for you. It is called foundations, not theory Foundations of computer science (or rather any field of study) are the most important topics you can learn. These lay down the frame of thinking/perspective for that area of study. Yet, I am saddened to hear these called as "theory", and labeled as "unpractical". This couldn't be farther from the truth. Take a look at how I recommend studying distributed systems . Don't you dare call this "theory" and "unpractical". This lays the bedrock that you build your practice on. Don't skimp on the foundations. Don't build your home on quicksand. Keep your hands dirty, your mind cl... Read more >> Learning about distributed systems: where to start? - June 10, 2020 This is definitely not a "learn distributed systems in 21 days" post. I recommend a principled, from the foundations-up, studying of distributed systems, which will take a good three months in the first pass, and many more months to build competence after that. If you are practical and coding oriented you may not like my advice much. You may object saying, "Shouldn't I learn distributed systems with coding and hands on? Why can I not get started by deploying a Hadoop cluster, or studying the Raft code." I think that is the wrong way to go about learning distributed systems, because seeing similar code and programming language constructs will make you think this is familiar territory, and will give you a false sense of security. But, nothing can be further from the truth. Distributed systems need radically different software than centralized systems do. --A. Tannenbaum This quotation is literally the first sentence in my distributed systems syllabus. Inst... Read more >> Scalable OLTP in the Cloud: What's the BIG DEAL? - January 17, 2024 Image This paper is from Pat Helland, the apostate philosopher of database systems, overall a superb person, and a good friend of mine. The paper appeared this week at CIDR'24. (Check out the program for other interesting papers). The motivating question behind this work is: " What are the asymptotic limits to scale for cloud OLTP (OnLine Transaction Processing) systems? " Pat says that the CIDR 2023 paper "Is Scalable OLTP in the Cloud a Solved Problem?" prompted this question. The answer to the question? Pat says that the answer lies in the joint responsibility of database and the application. If you know of Pat's work, which I have summarized several in this blog , you would know that Pat has been advocating along these lines before. But this paper provides a very crisp, specific, concrete answer. Read on for my summary of the paper. Disclaimer: This is a wisdom and technical information/detail packed 13-page paper, so I will try my best to summarize the sa... Read more >> Foundational distributed systems papers - February 27, 2021 I talked about the importance of reading foundational papers last week. To followup, here is my compilation of foundational papers in the distributed systems area. (I focused on the core distributed systems area, and did not cover networking, security, distributed ledgers, verification work etc. I even left out distributed transactions, I hope to cover them at a later date.) I classified the papers by subject, and listed them in chronological order. I also listed expository papers and blog posts at the end of each section. Time and State in Distributed Systems Time, Clocks, and the Ordering of Events in a Distributed System. Leslie Lamport, Commn. of the ACM, 1978. Distributed Snapshots: Determining Global States of a Distributed System. K. Mani Chandy Leslie Lamport, ACM Transactions on Computer Systems, 1985. Virtual Time and Global States of Distributed Systems. Mattern, F. 1988. Practical uses of synchronized clocks in distributed systems. B. Liskov, 1991. Exp... Read more >> What I'd do as a College Freshman in 2025 - April 10, 2025 Do Computer Science Absolutely. Still would. Many are spooked by LLMs. Some, like Jensen Huang, argue that "nobody has to learn how to program." I argue the opposite . And I double down. Being supported by AI tools is not a substitute for mastery . You can't borrow skills. You have to earn them. Computer science builds vital skills : hacking, debugging, abstract thinking, and quick adaptation. These don't go out of style. Do STEM. It's LLM-resistant. LLMs can retrieve and remix information, but do you know what to do with them? Like the dog chasing the car, what now? STEM teaches you that. It teaches you to think, to reason, to act. It gets you from information to wisdom. But only after you've mastered the foundations. We're heading into the age of p-shaped people: depth in two areas, and generalist across . Building depth first, and then ranging is good strategy . So yes, I would learn the foundations of both CS and AI. And then do AI + X, where X is s... Read more >> Distributed Transactions at Scale in Amazon DynamoDB - August 17, 2023 Image This paper appeared in July at USENIX ATC 2023. If you haven't read about the architecture and operation of DynamoDB, please first read my summary of the DynamoDB ATC 2022 paper . The big omission in that paper was discussion about transactions. This paper amends that. It is great to see DynamoDB, and AWS in general, is publishing/sharing more widely than before. Overview A killer feature of DynamoDB is predictability at any scale. Do read Marc Brooker's post to fully appreciate this feature. Aligned with this predictability tenet, when adding transactions to DynamoDB, the first and primary constraint was to preserve the predictable high performance of single-key reads/ writes at any scale. The second big constraint was to implement transactions using update in-place operation without multi-version concurrency control. The reason for this was they didn't want to mock with the storage layer which did not support multi-versioning. Satisfying both of the above constraints may s... Read more >> Powered by Blogger Theme images by Michael Elkan Murat Demirbas My photo Murat I am a principal research scientist at MongoDB Research. Ex-AWS. On leave as a computer science and engineering professor at SUNY Buffalo. I work on distributed systems, distributed consensus, and cloud computing. You can follow me on Mastodon or Twitter. Visit profile Pageviews Recent Posts * May5 * April2 * March3 * February5 * January5 * December8 * November5 * October8 * September10 * August9 * July3 * June5 * May2 * April6 * March6 * February9 * January7 * December3 * November4 * October4 * September4 * August4 * July5 * June2 * May3 * April3 * March3 * February5 * January3 * December4 * November4 * October1 * September4 * August5 * July6 * June3 * May3 * April4 * March3 * February3 * January3 * December5 * November3 * October6 * September1 * August4 * July2 * June12 * May1 * April1 * March4 * February4 * January4 * December3 * November7 * October4 * September1 * August3 * July6 * June11 * May9 * April8 * March8 * February7 * January9 * December10 * November14 * October6 * September13 * July3 * June3 * May4 * April6 * March2 * February1 * January3 * December4 * November7 * October2 * September2 * August8 * July2 * June4 * May9 * April6 * March9 * February5 * January13 * December15 * November15 * October5 * September8 * August10 * July3 * June3 * May3 * April4 * February4 * January7 * December7 * November9 * October3 * September1 * July4 * June5 * May1 * April4 * March2 * February2 * January4 * December3 * November2 * October3 * September2 * August3 * June1 * May1 * April6 * March6 * February4 * January3 * November4 * October4 * September6 * August2 * July2 * June3 * March3 * February4 * January1 * December1 * November2 * August2 * July4 * June2 * May5 * April8 * January1 * December1 * November7 * October1 * September2 * August1 * May2 * March1 * February1 * January2 * December3 * September5 * June1 * May5 * April5 * March5 * February9 * January5 * December6 * November9 * October9 * September7 * August1 Show more Show less Topics 2PC1 abstraction6 AI5 analytics3 atomic storage2 auditability5 automated reasoning12 aws5 Azure11 benchmarks4 bestof8 big-data30 Blockchain39 book-review54 calm5 chaos2 cloud computing17 ConcurrencyControlBook2 consistency32 Cosmos DB11 CosmosDB12 crdts2 data warehouse2 databases56 datacenter networking1 dataflow11 dbos1 DDIA15 disaggregation2 distributed consensus49 distributed transactions37 distSQL8 facebook16 failures18 fault-tolerance46 formal methods14 graph-processing1 hpts3 htap3 humans10 indexing3 isolation levels4 links2 mad-questions42 main-memory1 measuring1 metastability2 microservices2 misc118 ML1 mlbegin7 mldl26 mobile2 mongodb9 MVCC1 my advice19 my-paper10 networking1 newsql3 NoSQL2 OLAP2 OLTP7 paper-review149 paxos51 postgres1 presenting4 privacy1 programming7 query-processing2 raft2 RDMA2 reading-group23 reconfiguration4 research-advice52 research-question44 Rust3 scheduling3 security1 seminar9 serializability1 serverless1 smartphones2 snapshot isolation5 sonification1 SQL6 stabilization6 statistics3 stream-processing12 teaching31 tensorflow11 time19 time synchronization5 timeDB7 tla56 tpbook1 transactions32 trip-report32 wpaxos6 writing30 Show more Show less