CS FundamentalsVery hardProduct-company placement · GATE CS
A hospital requires at least one doctor on call. Doctors Ana and Ben are both on call. Each starts a transaction under snapshot isolation, checks that the number of on-call doctors is at least 2, and then sets only their own row to off-call; both commit. What is the result?
- A. Both commit and nobody is on call (write skew)
- B. The second commit fails with a write-write conflict
- C. Snapshot isolation serialises them, so exactly one is still on call
- D. Both block forever waiting for each other's row lock
Correct answer: A. Both commit and nobody is on call (write skew)
Each transaction reads the same snapshot (2 on call) and writes a different row, so snapshot isolation's first-committer-wins check finds no write-write conflict. Both commit and the constraint breaks; only serializable isolation (e.g. SSI) or a lock on the read rows prevents this.
More DBMS and SQL questions
- 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…
- R occupies 1000 blocks and S 500 blocks; 50 buffer blocks are available. Ignoring the cost of writing the result, what does a Grace hash…