Skip to content
Official PYQ · 2014

GATE CS 2014 Set 1 Q29 — Transactions and Concurrency Control

Explain with AI

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?

Choose one option
View worked solution

Answer: D

A schedule is conflict serializable if its precedence (conflict) graph is acyclic. An edge Ti→TjT_i \to T_j exists in the precedence graph if there are operations Oi(x)O_i(x) in TiT_i and Oj(x)O_j(x) in TjT_j such that:

  1. Oi(x)O_i(x) appears before Oj(x)O_j(x) in the schedule.
  2. At least one of them is a write operation (w(x)w(x)).

Let's analyze the precedence graph for each option:

  • Option A: r1(x);r2(x);w1(x);r3(x);w2(x);r_1(x); r_2(x); w_1(x); r_3(x); w_2(x);
    • r2(x)r_2(x) is followed by w1(x)  ⟹  T2→T1w_1(x) \implies T_2 \to T_1
    • w1(x)w_1(x) is followed by w2(x)  ⟹  T1→T2w_2(x) \implies T_1 \to T_2
    • This creates a cycle: T2⇆T1T_2 \leftrightarrows T_1. Thus, it is not conflict serializable.
  • Option B: r2(x);r1(x);w2(x);r3(x);w1(x);r_2(x); r_1(x); w_2(x); r_3(x); w_1(x);
    • r1(x)r_1(x) is followed by w2(x)  ⟹  T1→T2w_2(x) \implies T_1 \to T_2
    • w2(x)w_2(x) is followed by w1(x)  ⟹  T2→T1w_1(x) \implies T_2 \to T_1
    • This creates a cycle: T1⇆T2T_1 \leftrightarrows T_2. Thus, it is not conflict serializable.
  • Option C: r3(x);r2(x);r1(x);w2(x);w1(x);r_3(x); r_2(x); r_1(x); w_2(x); w_1(x);
    • r1(x)r_1(x) is followed by w2(x)  ⟹  T1→T2w_2(x) \implies T_1 \to T_2
    • w2(x)w_2(x) is followed by w1(x)  ⟹  T2→T1w_1(x) \implies T_2 \to T_1
    • This creates a cycle: T1⇆T2T_1 \leftrightarrows T_2. Thus, it is not conflict serializable.
  • Option D: r2(x);w2(x);r3(x);r1(x);w1(x);r_2(x); w_2(x); r_3(x); r_1(x); w_1(x);
    • w2(x)w_2(x) is followed by r3(x)  ⟹  T2→T3r_3(x) \implies T_2 \to T_3
    • w2(x)w_2(x) is followed by r1(x)r_1(x) and w1(x)  ⟹  T2→T1w_1(x) \implies T_2 \to T_1
    • r3(x)r_3(x) is followed by w1(x)  ⟹  T3→T1w_1(x) \implies T_3 \to T_1
    • The resulting precedence graph has edges: T2→T3T_2 \to T_3, T2→T1T_2 \to T_1, and T3→T1T_3 \to T_1.
    • This graph is acyclic, with the equivalent serial order being T2→T3→T1T_2 \to T_3 \to T_1.

Therefore, only the schedule in Option D is conflict serializable.

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

Published
Report a correction
Keep exploringMore Transactions and Concurrency Control questions