CS FundamentalsHardGATE CS · Product-company placement

Two transactions each read row X under a shared lock and later want to update it, so each requests an upgrade to an exclusive lock. What happens under strict 2PL, and what is the usual remedy?

  1. A. Both upgrades succeed because they hold the same lock
  2. B. They deadlock; taking an update (U) lock at read time lets only one of them plan an upgrade
  3. C. The second upgrade waits until the first commits, so no deadlock is possible
  4. D. Strict 2PL releases shared locks early, so the upgrades go through in turn

Correct answer: B. They deadlock; taking an update (U) lock at read time lets only one of them plan an upgrade

Each waits for the other's shared lock to be released before it can get X, and neither releases until commit: a deadlock. U locks are compatible with S but not with other U locks, so only one transaction can be waiting to upgrade.

More DBMS and SQL questions

Exams that ask this topic