CS FundamentalsVery hardGATE CS (PYQ pattern)
Under strict two-phase locking (shared locks for reads, exclusive for writes, all locks held until commit; a transaction whose lock request conflicts must wait, so a schedule is allowed only if no request ever conflicts), which of these schedules can be produced? All four are conflict-serializable. (A) R3(X), W2(Y), W3(Y), R2(X), R3(X), C2, R3(Y), C3 (B) W3(Y), W3(X), R3(X), R1(Y), R3(X), C1, R3(X), C3 (C) R1(Y), C1, R3(X), W3(X), R2(X), R3(X), C3, R2(Y), C2 (D) W2(Y), W3(X), W2(Y), C3, W1(X), C2, R1(X), R1(Y), C1
- A. (D)
- B. (A)
- C. (B)
- D. (C)
Correct answer: A. (D)
Check each schedule for a read or write by one transaction on an item that another still-uncommitted transaction has read-locked (for a write) or write-locked (for any access). Only one schedule has no such conflict; the others are serializable but need locks to be released early.
More DBMS and SQL questions
- A B+ tree has leaf nodes holding at most 3 keys. Keys are inserted in the order 50, 20, 80, 10, 30, 60, 90, 70, 40, 25, 35, 5, 65, 75, 95…
- A query joins 5 relations R1..R5 and the optimiser considers every possible join tree, including bushy trees, with every distinct…
- R occupies 1000 pages with 100 tuples per page. S has a B+ tree index on the join attribute (3 levels, so 3 page reads to reach a leaf…
- A table has 100,000 rows in 2500 pages, and a predicate selects 3% of the rows, which are spread uniformly at random over the pages. An…
- A heap file stores 1,000,000 fixed-length records of 150 bytes in 8192-byte blocks with no block header; records do not span blocks. How…
- R(A, B, C, D, E, F) has the functional dependencies BC → D, F → D, F → C, C → D, E → C, DC → E. Counting only the listed dependencies, how…