CS FundamentalsHardProduct-company MCQ pattern

Two transactions, T1 and T2, both want to update the same row. T1 acquires a shared (read) lock, then later tries to upgrade to an exclusive (write) lock on the same row, while T2 is simultaneously also holding a shared lock on that row and trying to upgrade. What classic problem can this cause?

  1. A. It can only happen with more than 2 transactions
  2. B. No problem; lock upgrades always succeed immediately
  3. C. A deadlock: each transaction holds a shared lock the other needs released before its own upgrade to exclusive can proceed, and neither will release its shared lock first
  4. D. This situation guarantees serializability automatically

Correct answer: C. A deadlock: each transaction holds a shared lock the other needs released before its own upgrade to exclusive can proceed, and neither will release its shared lock first

Lock upgrade deadlock is a classic case: T1 and T2 both hold a shared lock on the same row, and both want to upgrade to exclusive, which requires the OTHER transaction's shared lock to be released first. Neither will give up its own shared lock (each is also waiting to upgrade), so both wait forever — a two-transaction deadlock caused purely by simultaneous lock upgrades.

More DBMS and SQL questions

Exams that ask this topic