Skip to content
Official PYQ · 2009

GATE CS 2009 Q43 — Transactions and Concurrency Control

Explain with AI

Consider two transactions T1T_1 and T2T_2, and four schedules S1,S2,S3,S4S_1, S_2, S_3, S_4,  of  T1T_1  and  T2T_2 as given below:

T1:R1[x]W1[x]W1[y]T_1: R_1[x]W_1[x]W_1[y]

T2:R2[x]R2[y]W2[y]T_2: R_2[x]R_2[y]W_2[y]

S1:R1[x]R2[x]R2[y]W1[x]W1[y]W2[y]S_1: R_1[x]R_2[x]R_2[y] W_1[x] W_1[y] W_2[y]

S2:R1[x]R2[x]R2[y]W1[x]W2[y]W1[y]S_2: R_1[x]R_2[x]R_2[y] W_1[x] W_2[y] W_1[y]

S3:R1[x]W1[x]R2[x]W1[y]R2[y]W2[y]S_3: R_1[x]W_1[x]R_2[x] W_1[y] R_2[y] W_2[y]

S4:R2[x]R2[y]R1[x]W1[x]W1[y]W2[y]S_4: R_2[x]R_2[y]R_1[x] W_1[x] W_1[y] W_2[y]

Which of the above schedules are conflict-serializable?

Choose one option
View worked solution

Answer: B

A schedule is conflict-serializable if its precedence graph contains no cycles. The vertices of the graph are the transactions, and a directed edge Ti→TjT_i \to T_j exists if there is a conflicting pair of operations (accessing the same data item with at least one write operation) such that TiT_i's operation occurs before TjT_j's operation.

Let's analyze each schedule:

  • Schedule S1S_1:
    • R2[x]R_2[x] occurs before W1[x]  ⟹  T2→T1W_1[x] \implies T_2 \to T_1
    • W1[y]W_1[y] occurs before W2[y]  ⟹  T1→T2W_2[y] \implies T_1 \to T_2
    Since there is a cycle (T1↔T2T_1 \leftrightarrow T_2), S1S_1 is not conflict-serializable.

  • Schedule S2S_2:
    • R2[x]R_2[x] occurs before W1[x]  ⟹  T2→T1W_1[x] \implies T_2 \to T_1
    • R2[y]R_2[y] occurs before W1[y]  ⟹  T2→T1W_1[y] \implies T_2 \to T_1
    • W2[y]W_2[y] occurs before W1[y]  ⟹  T2→T1W_1[y] \implies T_2 \to T_1
    The only directed edge is T2→T1T_2 \to T_1. Since there are no cycles, S2S_2 is conflict-serializable.

  • Schedule S3S_3:
    • W1[x]W_1[x] occurs before R2[x]  ⟹  T1→T2R_2[x] \implies T_1 \to T_2
    • W1[y]W_1[y] occurs before R2[y]  ⟹  T1→T2R_2[y] \implies T_1 \to T_2
    • W1[y]W_1[y] occurs before W2[y]  ⟹  T1→T2W_2[y] \implies T_1 \to T_2
    The only directed edge is T1→T2T_1 \to T_2. Since there are no cycles, S3S_3 is conflict-serializable.

  • Schedule S4S_4:
    • R2[x]R_2[x] occurs before W1[x]  ⟹  T2→T1W_1[x] \implies T_2 \to T_1
    • W1[y]W_1[y] occurs before W2[y]  ⟹  T1→T2W_2[y] \implies T_1 \to T_2
    Since there is a cycle (T1↔T2T_1 \leftrightarrow T_2), S4S_4 is not conflict-serializable.

Thus, only S2S_2 and S3S_3 are conflict-serializable.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Transactions and Concurrency Control questions