Locking mechanism
A protocol that prevents two transactions from modifying the same data simultaneously by granting exclusive access.
A traditional approach to concurrency: when transaction A reads a row, it acquires a read lock (others can read but no one can write). For writes, a write lock is exclusive — no other transaction can read or write. Locks are released on commit. Simple and safe, but slow: everyone else waits.
Two-phase locking — the textbook solution — was implemented in virtually every major DBMS from the 1970s onward. One hazard is deadlock: transaction A waits for row X (held by B), transaction B waits for row Y (held by A). The system must detect this and abort one of them.