CS FundamentalsHardProduct-company MCQ pattern

Deadlock prevention with timestamps: T1 (timestamp 5) is older than T2 (timestamp 10). T2 holds a lock on X and T1 requests it; separately, T1 holds a lock on Y and T2 requests it. What happens under wait-die and under wound-wait?

  1. A. Both schemes roll back the older transaction in both cases
  2. B. Wait-die: T1 waits for X, T2 is rolled back on Y. Wound-wait: T2 is rolled back on X, T2 waits for Y
  3. C. Both schemes make the younger transaction wait in both cases
  4. D. Wait-die: T1 is rolled back on X, T2 waits for Y. Wound-wait: T1 waits for X, T2 is rolled back on Y

Correct answer: B. Wait-die: T1 waits for X, T2 is rolled back on Y. Wound-wait: T2 is rolled back on X, T2 waits for Y

Wait-die: an older requester waits, a younger requester dies. So T1 waits for X; T2 asking for Y dies. Wound-wait: an older requester wounds (rolls back) the younger holder, so T2 is rolled back for X; a younger requester waits, so T2 waits for Y. In both, only the younger transaction is ever rolled back.

More DBMS and SQL questions

Exams that ask this topic