img
Question:
Published on: 25 April, 2024

Let T1, T2, T3 be transactions that operate on the same data items A, B, C. Let r1(A) means that T1 reads A, w1(A) means that T1 writes A and so on for T2 and T3. Consider the following schedule: S1: r2(C), r2(B), w2(B), r3(C), r1(A), w1(A), w3(B), w3(C), r2(A), r1(B), w1(B), w2(A). Is the schedule serializable and why?

Answer:

precedence graph, also named conflict graph and serializability graph, is used in the context of concurrency control in databases.

  • The precedence graph for a schedule S contains:
  • A node for each committed transaction in S.

An arc from Ti to Tj if an action of Ti precedes and conflicts with one of Tj's actions.

The drawing sequence for the precedence graph:-

  1. For each transaction Ti participating in schedule S, create a node labeled Ti in the precedence graph. So the precedence graph contains T1, T2, T3
  2. For each case in S where Ti executes a write_item(X) then Tj executes a read_item(X), create an edge (Ti --> Tj) in the precedence graph. This occurs nowhere in the above example, as there is no read after write.
  3. For each case in S where Ti executes a read_item(X) then Tj executes a write_item(X), create an edge (Ti --> Tj) in the precedence graph. This will bring to front a directed graph from T1 to T2.
  4. For each case in S where Ti executes a write_item(X) then Tj executes a write_item(X), create an edge (Ti --> Tj) in the precedence graph. It creates a directed graph from T2 to T1, T1 to T3, and T2 to T3.

The schedule S is serializable if the precedence graph has no cycles. As T1 and T2 constitute a cycle, then we cannot declare S as serializable.

The Precedence Graph is cyclic, so, this is not serializable.

Random questions