The GATE Grind

GATE 2012 CS (CS1) – Question 37

Databases · Transactions and Concurrency Control · 2 marks · Multiple choice

P=Q=0 initially. T₁ executes read(P); read(Q); if P==0 then Q:=Q+1; write(Q). T₂ executes read(Q); read(P); if Q==0 then P:=P+1; write(P). Any nonserial interleaving leads to

  1. a serializable schedule
  2. a schedule not conflict-serializable
  3. a conflict-serializable schedule
  4. a schedule with no drawable precedence graph

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (B) a schedule not conflict-serializable

Explanation

A nonserial overlap lets T₁’s read of P precede T₂’s write of P and T₂’s read of Q precede T₁’s write of Q. These conflicts create edges T₁→T₂ and T₂→T₁, a cycle, so the schedule is not conflict-serializable, B. A precedence graph can still be drawn; cyclicity is the issue.

More Transactions and Concurrency Control questions

All Transactions and Concurrency Control questions →