CS FundamentalsHardGATE CS
Timestamps: T1 = 10 (oldest), T2 = 20, T3 = 30. T2 holds an exclusive lock on X. First T1 requests X, then T3 requests X. Which is correct?
- A. Wait-die: T1 waits and T3 is rolled back; wound-wait: T2 is rolled back for T1, and T3 waits
- B. Wait-die: T1 is rolled back and T3 waits; wound-wait: T1 waits and T3 is rolled back
- C. Wait-die: both T1 and T3 wait; wound-wait: T2 is rolled back for both
- D. Wait-die: T1 waits and T3 waits; wound-wait: T1 and T3 are both rolled back
Correct answer: A. Wait-die: T1 waits and T3 is rolled back; wound-wait: T2 is rolled back for T1, and T3 waits
Wait-die: an older requester waits, a younger one dies, so T1 waits and T3 dies. Wound-wait: an older requester wounds (aborts) the younger holder, a younger requester waits, so T2 is aborted for T1 and T3 waits.
More DBMS and SQL questions
- A hospital requires at least one doctor on call. Doctors Ana and Ben are both on call. Each starts a transaction under snapshot isolation…
- An account has balance 1000. Two sessions at READ COMMITTED each run SELECT bal (both read 1000 before either writes), then compute 1000 −…
- 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…
- After ARIES analysis the dirty page table holds P1 (recLSN 40), P2 (recLSN 25) and P3 (recLSN 60); the last checkpoint began at LSN 30…
- A DBMS uses deferred database modification: no change reaches the database before its transaction commits (NO-STEAL), but committed…
- A B+ tree stores 1,000,000 keys. Each internal node has at most 50 children (at least 25, except the root, which needs at least 2), and…