Skip to main content

GATE CSE 2014Databases › Transactions, Concurrency Control & IndexingVerified

GATE CSE 2014 PYQ: Consider the following four schedules due to three transactions (indicated by the subscript) using read and…

Consider the following four schedules due to three transactions (indicated by the subscript) using read and write on a data item x, denoted by r(x)r(x) and w(x)w(x) respectively. Which one of them is conflict serializable?

  1. A
    r1(x)r_1(x); r2(x)r_2(x); w1(x)w_1(x); r3(x)r_3(x); w2(x)w_2(x);
  2. B
    r2(x)r_2(x); r1(x)r_1(x); w2(x)w_2(x); r3(x)r_3(x); w1(x)w_1(x);
  3. C
    r3(x)r_3(x); r2(x)r_2(x); r1(x)r_1(x); w2(x)w_2(x); w1(x)w_1(x);
  4. D
    r2(x)r_2(x); w2(x)w_2(x); r3(x)r_3(x); r1(x)r_1(x); w1(x)w_1(x);
    Correct answer

Answer

(D) r 2 ( x ) r_2(x) r 2 ​ ( x ) ; w 2 ( x ) w_2(x) w 2 ​ ( x ) ; r 3 ( x ) r_3(x) r 3 ​ ( x ) ; r 1 ( x ) r_1(x) r 1 ​ ( x ) ; w 1 ( x ) w_1(x) w 1 ​ ( x ) ;

Approach

For each schedule, construct a precedence graph among transactions T1, T2, and T3. A conflict exists when two operations from different transactions access the same data item x and at least one is a write. Add an edge $T_i$ -> $T_j$ if a conflicting operation of $T_i$ precedes one of $T_j$. The schedule is conflict serializable exactly when the precedence graph has no cycle.

Only option D produces an acyclic precedence graph. The other schedules each contain a cycle between T1 and T2, so they are not conflict serializable.

Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.