notesonly.in

One notebook for every subject — open it anywhere.

Log in

Concurrency control and locking

Database Management Systems · Engineering

Study notes

Two users book the last seat: both read seats=1, both write seats=0, both confirm. One seat sold twice: lost update. Strict 2PL fixes it: the first transaction's exclusive lock on the row blocks the second until commit. Deadlock risk: if T1 locks A then wants B while T2 locks B then wants A, both wait forever; detection aborts one.

← Back to topics for Engineering