GATE / CS ARCHIVE

GATE CSE 2017 SET 2 / QUESTION 44

GATE CSE 2017 Set 2 Q44

Database Management Systems · Transactions & Concurrency Control · Full GATE CSE 2017 Set 2 paper

GATE 2017 Set 2, Q44 2 marks · NAT
Report issue

Transactions & Concurrency Control

Question 44, GATE 2017: Transactions are T1:r1(X),w1(X),r1(Y),w1(Y) and T2:r2(Y),w2(Y),r2(Z),w2(Z). Here r and w denote read and write operations. How many order-preserving interleavings of the eight operations are conflict serializable?
Tap to enlarge
Answer & solution

Official answer: 54.0

Our answer: 54

1. Each schedule is an interleaving of four operations from each transaction, so there are C(8,4)=70 candidates. Only Y is shared; read/write or write/write pairs on Y create precedence-graph edges. A schedule is serializable precisely when it does not create edges in both directions.

2. For order T1→T2, w1(Y) must precede r2(Y). Since these are respectively the last T1 and first T2 operations, this requires the single serial schedule 11112222, where digits identify transactions.

3. For order T2→T1, w2(Y) must precede r1(Y): the second 2 must occur before the third 1. Count its complement, third 1 before second 2. If the third 1 occurs at position 3, the prefix is 111 and the last 1 has 5 possible positions. If it occurs at position 4, the first three positions contain two 1s and one 2 in 3 arrangements, and the final 1 has 4 positions. The complement has 5+12=17 schedules, so this serial order has 70-17=53.

4. The two acyclic cases are disjoint, yielding 1+53=54. This counts conflict serializability, not only the two fully serial schedules. Independent enumeration of all 70 order-preserving interleavings confirms the count.

Original paper, page 18 · Answer key