GATE / CS ARCHIVE

SIMILAR QUESTIONS / DATABASE MANAGEMENT SYSTEMS

Build conflict edges and test topological orders

11 questions solved the same way, newest first. Back to Database Management Systems

How these are solved

For different transactions on the same item, add an edge in operation order whenever at least one operation writes. Test cycles or enumerate topological orders as asked; commit/recoverability is a separate property.

2 marks · MSQ
Report issue

Transactions & Concurrency Control

Question 53, GATE 2025: R_i(V) and W_i(V) denote transaction i reading/writing item V; C_i is its commit. Select all conflict-serializable schedules.
A. R1(X),W2(X),W1(Y),W2(Y),R1(X),W1(X),C2,C1.
B. W2(X),R1(X),W2(Y),W1(Y),R1(X),C2,W1(X),C1.
C. R1(X),W1(Y),W2(X),W2(Y),R1(X),W1(X),C1,C2.
D. W2(X),R1(X),W1(Y),W2(Y),R1(X),C2,W1(X),C1.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B

Step through it (4 schedules)

Construct a precedence graph with vertices T1,T2. Two operations conflict when they are in different transactions, access the same item, and at least one is a write. An earlier conflicting operation from Ti followed by one from Tj creates edge Ti→Tj. The schedule is conflict-serializable exactly when this graph is acyclic.

In A, the first R1(X) precedes W2(X), giving T1→T2. The later R1(X), and also W1(X), follow W2(X), giving T2→T1. There is a cycle. C has the same two conflicting directions on X, so it also fails.

In B, W2(X) precedes both reads and the write of X by T1. On Y, W2(Y) precedes W1(Y). Thus all intertransaction conflicts point T2→T1; there is no reverse edge. This is conflict-equivalent to serial order T2 followed by T1.

In D, the X conflicts point T2→T1, but W1(Y) precedes W2(Y), adding T1→T2 and creating a cycle. Commit positions do not remove conflicts or make a cyclic precedence graph acyclic. Select B only. Conflict serializability is a property distinct from whether an interleaving satisfies a particular recovery or locking protocol.

Original paper, page 41 · Answer key

2 marks · MSQ
Report issue

Build the transaction precedence graph

Transactions & Concurrency Control

Question 46, GATE 2024: The schedule is r1(z); w1(z); r2(x); r3(y); w3(y); r2(y); w2(x); w2(y), where subscripts name transactions. Which serial schedules are conflict equivalent? A T1 T2 T3; B T1 T3 T2; C T3 T2 T1; D T3 T1 T2.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B, C, D

Step through it (10 steps)

Approach: Only operations from different transactions on the same data item, with at least one write, impose conflict-order constraints.
1. Transaction T1 touches only z. Neither T2 nor T3 uses z, so T1 has no conflicts with the others and may appear anywhere in a serial order.
2. Only T2 accesses x, so x creates no intertransaction constraint.
3. On y, T3's read and write precede T2's read and write. Conflicting pairs include w3(y) before r2(y), w3(y) before w2(y), and r3(y) before w2(y). Each demands the same precedence edge T3→T2.
4. A conflict-equivalent serial order must therefore put T3 before T2, with T1 free. The valid orders are T1 T3 T2, T3 T2 T1, and T3 T1 T2.
Answer: B, C and D. Option A reverses the y-conflict order. Merely knowing that the precedence graph is acyclic establishes serializability; enumerating its topological orders identifies the actual choices.

Original paper, page 29 · Answer key

2 marks · MCQ
Report issue

Transactions & Concurrency Control

Question 39, GATE 2022: With Ri(z),Wi(z) denoting transaction i's reads/writes, schedule S is R4(x),R2(x),R3(x),R1(y),W1(y),W2(x),W3(y),R4(y). Choose a conflict-equivalent serial order: A 1,3,4,2; B 1,4,3,2; C 4,1,3,2; D 3,1,4,2.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Step through it (10 steps)

Conflicts on x give T4→T2 and T3→T2. Conflicts on y give T1→T3, T1→T4 and T3→T4. Their topological order is T1, T3, T4, T2, option A. Read-read pairs add no edges.

The precedence graph can be drawn as T1→T3→T4→T2, with additional T1→T4 and T3→T2 edges. Each edge enforces the same relative ordering of conflicting operations in a serial schedule. Since this chain orders all four transactions, the topological order is unique.

Original paper, page 25 · Answer key

2 marks · MCQ
Report issue

Asked again GATE 2007, Q64 (same question)

Transactions & Concurrency Control

Question 32, GATE 2021: Let ri(z),wi(z) denote reads/writes by transaction Ti. S1=r1(x),r1(y),r2(x),r2(y),w2(y),w1(x). S2=r1(x),r2(x),r2(y),w2(y),r1(y),w1(x). Which schedules are conflict-serializable? A S1 only; B S2 only; C both; D neither.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Step through it (2 schedules)

In S1, r1(y) before w2(y) gives T1→T2, while r2(x) before w1(x) gives T2→T1, creating a cycle. In S2, w2(y) before r1(y) and r2(x) before w1(x) both give only T2→T1. Therefore S1 is not conflict-serializable while S2 is, equivalent to T2 thenT1. Answer B.

Only different transactions accessing the same item, with at least one write, create precedence edges. Reads of x by both transactions do not conflict. In S1, y imposes T1 before T2 whereas x imposes T2 before T1, making a directed cycle. Moving r1(y) after w2(y) in S2 reverses the y constraint; all constraints now agree. An acyclic precedence graph is the necessary and sufficient test for conflict serializability.

Original paper, page 28 · Answer key

1 mark · MCQ
Report issue

Transactions & Concurrency Control

Question 22, GATE 2016: Build a schedule’s precedence graph with transactions as vertices and conflicts as directed edges. If the schedule is “serializable,” which vertex order guarantees a serial schedule? A topological; B depth-first; C breadth-first; D increasing transaction index. Explain the intended meaning of serializable.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Our answer: A under conflict-serializability interpretation

An acyclic precedence graph admits a topological order, and placing transactions in that order respects every conflicting pair, yielding a conflict-equivalent serial schedule. Thus A. The word serializable must mean conflict-serializable here: view-serializable schedules can have cyclic conflict graphs (for example blind writes w1(X), w2(X), w1(X)), so a topological order need not exist under that broader meaning.

An edge Ti→Tj says a conflicting operation of Ti precedes one of Tj and that order must be preserved. A topological sort respects every such edge; ordinary traversal orders need not. For example an edge T2→T1 rules out increasing index order. Graph acyclicity is both necessary and sufficient for conflict serializability, not for every broader serializability notion.

Original paper, page 31 · Answer key

2 marks · MCQ
Report issue

Transactions & Concurrency Control

Question 29, GATE 2014: On one item x, which schedule is conflict serializable? Subscripts identify transactions. A: r₁(x);r₂(x);w₁(x);r₃(x);w₂(x). B: r₂(x);r₁(x);w₂(x);r₃(x);w₁(x). C: r₃(x);r₂(x);r₁(x);w₂(x);w₁(x). D: r₂(x);w₂(x);r₃(x);r₁(x);w₁(x).
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Step through it (4 schedules)

1. Method and setup. Build a precedence graph with one vertex per transaction. Add an edge for time-ordered accesses by different transactions to x when at least one is a write; two reads alone create no conflict. The schedule is conflict serializable exactly when this graph is acyclic.

2. Work through the result and its assumptions. A and B each contain conflicting edges 1→2 and 2→1. C likewise has 1→2 from r1 before w2 and 2→1 from r2 before w1. D has edges 2→3, 2→1, 3→1 and no cycle, with serial order T2, T3, T1. Thus D.

Original paper, page 14 · Answer key

2 marks · MCQ
Report issue

Transactions & Concurrency Control

Question 29, GATE 2014: Transactions are T1:r1(X),r1(Z),w1(X),w1(Z); T2:r2(Y),r2(Z),w2(Z); T3:r3(Y),r3(X),w3(Y). S1=r1(X),r3(Y),r3(X),r2(Y),r2(Z),w3(Y),w2(Z),r1(Z),w1(X),w1(Z). S2=r1(X),r3(Y),r2(Y),r3(X),r1(Z),r2(Z),w3(Y),w1(X),w2(Z),w1(Z). Which schedules are conflict-serializable? A only S1; B only S2; C both; D neither.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Step through it (2 schedules)

Step 1: Construct a precedence graph: add Ti→Tj when conflicting operations from different transactions access the same item, at least one is a write, and Ti's operation occurs first. Read/read pairs create no edge. Step 2: In S1, Y gives T2→T3, X gives T3→T1, and Z gives T2→T1. The graph is acyclic, with serial order T2,T3,T1. Step 3: In S2, r1(Z) precedes w2(Z), giving T1→T2; r2(Z) and w2(Z) precede w1(Z), giving T2→T1. This two-way cycle suffices to reject conflict serializability. Thus only S1 is conflict-serializable, A.

Original paper, page 59 · Answer key

2 marks · MCQ
Report issue

Conflict-serializable schedule

Transactions & Concurrency Control

Question 42, GATE 2010: Transactions T1,T2,T3 execute this schedule, in time order: r1(X), r2(Y), r3(Y), w2(Y), w1(X), w3(X), r2(X), w2(X). Which serial order is equivalent to the schedule?
Options: (A) T1→T3→T2; (B) T2→T1→T3; (C) T2→T3→T1; (D) T3→T1→T2.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

Step through it (10 steps)

In time order the schedule is r1(X), r2(Y), r3(Y), w2(Y), w1(X), w3(X), r2(X), w2(X). Conflicts on X impose T1→T3, T1→T2 and T3→T2; r3(Y) before w2(Y) also imposes T3→T2. There is no reverse edge. Its unique topological ordering is T1→T3→T2, option A.

Two operations conflict only if they belong to different transactions, access the same item, and at least one is a write. Reads r2(Y) and r3(Y) do not themselves create an edge. However r3(Y) before w2(Y) creates T3→T2. A topological ordering of the resulting acyclic graph gives a conflict-equivalent serial execution; source-code transaction numbering alone does not determine that order.

Original paper, page 10

2 marks · MCQ
Report issue

Conflict serializability of four schedules

Transactions & Concurrency Control

Question 43, GATE 2009: T1=R1x, W1x, W1y; T2=R2x, R2y, W2y. S1=R1x, R2x, R2y, W1x, W1y, W2y; S2=R1x, R2x, R2y, W1x, W2y, W1y; S3=R1x, W1x, R2x, W1y, R2y, W2y; S4=R2x, R2y, R1x, W1x, W1y, W2y. Which are conflict-serializable? A S1/S2; B S2/S3; C S3 only; D S4 only.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

Step through it (4 schedules)

S1 has T2→T1 from r2(x) before w1(x), but T1→T2 from w1(y) before w2(y), so it cycles. S2 has only T2→T1: both its reads and final write of y precede T1’s conflicting writes. S3 has only T1→T2, as w1(x) and w1(y) precede T2’s accesses. S4 cycles for the same opposing x and y directions as S1. Therefore S2 and S3 are conflict-serializable, B.

Build one vertex per transaction and add an edge when an earlier operation conflicts with a later operation of the other transaction on the same item, with at least one write. Reads of different items or two reads do not conflict. S2 has only 2→1, so it is equivalent to serial T2, T1; S3 has only 1→2. S1/S4 each contain both directions and therefore a directed cycle. Acyclicity, not whether operations are interleaved, determines conflict serializability.

Original paper, page 10

2 marks · MCQ
Report issue

Asked again GATE 2021 Set 1, Q32 (same question)

Conflict serializability of two schedules

Transactions & Concurrency Control

Question 64, GATE 2007: For two transactions, consider schedules S1: r1(X);r1(Y);r2(X);r2(Y);w2(Y);w1(X) and S2: r1(X);r2(X);r2(Y);w2(Y);r1(Y);w1(X). Which are conflict serializable?
Options:
(A) Both
(B) S1 only
(C) S2 only
(D) Neither
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

Step through it (2 schedules)

1. Approach. Create a precedence edge only between different transactions on the same item when at least one access is a write. Read–read pairs do not conflict. A cycle is exactly the obstruction to conflict serializability.

2. Derivation and interpretation. In S1, r1(Y) precedes w2(Y), producing T1 -> T2, while r2(X) precedes w1(X), producing T2 -> T1. The cycle prevents conflict serializability. In S2, w2(Y) precedes r1(Y) and r2(X) precedes w1(X), both giving T2 -> T1; there is no reverse edge. S2 is equivalent to serial order T2,T1. Thus C.

Original paper, page 16

2 marks · MCQ
Report issue

Serializability of a three-transaction schedule

Transactions & Concurrency Control

Question 87, GATE 2003: Three transactions act on D1,D2,D3. In chronological order the printed schedule is:
R2(D3), R2(D2), W2(D2), R3(D2), R3(D3), R1(D1), W1(D1), W3(D2), W3(D3), R2(D1), R1(D2), W1(D2), W2(D1).
Ri(D) and Wi(D) denote transaction Ti reading/writing D. Which is correct?
A. Serializable as T2,T3,T1
B. Serializable as T2,T1,T3
C. Serializable as T3,T2,T1
D. Not serializable
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

Step through it (15 steps)

1. On D1, T1 writes before T2 reads and writes, forcing edge T1→T2 in the conflict graph.
2. On D2, T2 writes before T3 reads/writes, forcing T2→T3; T3 writes before T1 reads/writes, forcing T3→T1. These edges already form T1→T2→T3→T1.
3. A directed cycle means no serial ordering can preserve all conflicts, so the schedule is not conflict-serializable.
4. Even view equivalence cannot rescue it: T2's D2 read is initial, T3 reads T2's D2 write, T1 reads T3's D2 write, and T2 reads T1's D1 write. Preserving these reads requires T2<T3<T1<T2, impossible. Therefore D holds even under the broader view-serializability interpretation.

Solution: On D1, T1 writes before T2 reads/writes, imposing T1→T2. On D2, T2 writes before T3 reads/writes, and T3 writes before T1 reads/writes, imposing T2→T3→T1. This cycle rules out conflict serializability, so D. It also rules out view serializability here: T2 reads the initial D2 value, T3 reads T2's D2 value, T1 reads T3's D2 value, and T2 reads T1's D1 value. Any view-equivalent serial order would need T2 before T3 before T1 before T2, which is impossible.

Original paper, page 13