Concurrency Control: ---------------------- Each transaction must obtain a lock for each operation, read (shared lock) to read an item and write (exclusive) lock to write an item. Read/Shared locks: Multiple transactions can hold shared lock on the same item Write/Exclusive locks: Only one transaction can hold a write lock on a specific item 2PL: Two phase locking: ------------------------- Any transaction can be in only one of the two phases: Growing phase: A transaction can get new locks. As soon as xact releases a lock, then it enters shrinking phase. Shrinking phase: A transaction can only release locks (but cannot get new locks). If a transaction manager implements two phase locking, then the resulting schedules are serializable. Proof: showing no cycles are possible using Two phase locking. ------------ Strict 2PL: No shrinking phase: Get locks and keep them until commit time. All schedules resulting from strict 2PL are also guaranteed to be serializable. -------------- shared_lock1(x) r1(x) .... upgrade_lock1(x) w1(x)