CS FundamentalsVery hardProduct company interview · GATE level
T1 executes R1(A); W1(A); R1(B) and T2 executes R2(B); W2(B); R2(A). Of the 20 possible interleavings of these two transactions (including the two serial ones), how many are conflict serializable?
- A. 10
- B. 2
- C. 8
- D. 12
Correct answer: C. 8
The only conflicting pairs are W1(A) with R2(A) and R1(B) with W2(B). The schedule is equivalent to T1, T2 only if W1(A) precedes R2(A) and R1(B) precedes W2(B). The second condition forces all of T1 before W2(B), so only R2(B) is free to sit in any of 4 positions among T1's three operations: 4 schedules. By symmetry, equivalence to T2, T1 needs W2(B) before R1(B) and R2(A) before W1(A), leaving only R1(A) free: 4 more. Every other interleaving has edges in both directions. Total 8, not just the 2 serial schedules.
More DBMS and SQL questions
- No transaction has committed yet in the schedule W1(A); R2(A); W2(B); R3(B); W4(B); R5(B). T1 now aborts. Besides T1, which transactions…
- A lock manager grants a request whenever it is compatible with the locks currently held; otherwise the requester waits. The requests…
- Transactions T1, T2 and T3 have timestamps 1, 2 and 3. All read and write timestamps of items A and C are initially 0, and the operations…
- A B+ tree uses 4096-byte blocks, 12-byte search keys, 8-byte block pointers and 10-byte record pointers. An internal node with p child…
- A B+ tree holds 10,000 keys in its leaves. A leaf holds at most 20 and at least 10 keys; an internal node has at most 30 and at least 15…
- A file has 200,000 fixed-length records of 200 bytes stored unspanned in 1024-byte blocks. A secondary index is built on a non-ordering…