GATE / CS ARCHIVE

GATE CSE 2021 SET 1 / QUESTION 32

GATE CSE 2021 Set 1 Q32

Database Management Systems · Transactions & Concurrency Control · Full GATE CSE 2021 Set 1 paper

GATE 2021 Set 1, Q32 2 marks · MCQ
Report issue

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