CMU 15-645 Concurrency Control summary

Before reading this article, you should know:

  • Transaction: a sequence of read and write operations
    • processing: BEGIN -> (executing) -> COMMIT/ABORT
    • ACID
    • Atomicity: All-or-nothing
    • Consistent: It looks correct to me
    • Isolation: every TX is isolated from others (as if alone)
    • Durability: store in non-volatile devices (survive failures)

How to make sure transaction is atomic

  • Approach 1: Logging
  • Approach 2: Shadow Paging

The essential of concurrency control

  • Serial Schedule

The definition of conflict

  • They are by different transactions
  • They are on the same object and at least one of them is a write
  • RW/WR/WW conflict:
    • Unrepeatable reads
    • Reading uncommitted data (a.k.a., Dirty Reads)
    • Overwriting committed data

Dependency Graphs (Precedence Graph)

  • conflict: acyclic
  • blind write: write a value without read it

2PL

  • Phase 1: Growing => get all required locks from manager [grants/denies]
  • Phase 2: Shrinking => release all locks it gained
  • Strict 2PL: release all locks at the end of TX

2PL Deadlock Prevention

  • Wait-Die (old waits for young)
  • Wound-Wait (young waits for old)