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?
- A. Both schemes roll back the older transaction in both cases
- 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
- C. Both schemes make the younger transaction wait in both cases
- 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
- Immediate-update recovery with a checkpoint. Log (oldest first): <T1 start>, <T1 commit>, <T2 start>, <checkpoint, active = {T2}>, <T3…
- A file of 30,000 records (100 bytes each, unspanned) is sorted on key K and stored in 1,024-byte blocks. A primary (sparse) index on K…
- A B+ tree indexes 1,000,000 keys. Every leaf holds 100 keys and every internal node has 100 children, and all nodes are completely full…
- An ER design has entity sets E1 and E2 joined by a one-to-one relationship R. Both E1 and E2 participate TOTALLY in R, and neither has a…
- Assertion (A): In SQL, WHERE dept = NULL returns no rows even when dept contains NULL values. Reason (R): A comparison with NULL using =…
- How many of the following statements are correct? 1. A phantom read occurs when re-running a query with the same predicate returns new…