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) and w(X) respectively. Which one of them is conflict serializable ? S 1 : r 1(X); r 2(X); w 1(X); r 3(X); w 2(X) S2: r 2(X); r 1(X); w 2(X); r 3(X); w 1(X) S 3 : r 3(X); r 2(X); r 1(X); w 2(X); w 1(X) S4 : r 2(X); w 2(X); r 3(X); r 1(X); w 1(X)
S 4
In a database system, concurrency control allows multiple transactions to execute seemingly simultaneously. A schedule represents the order in which operations from different transactions are interleaved. A key property for ensuring correctness in concurrent execution is serializability. A schedule is considered serializable if its result is equivalent to the result of some serial schedule (a schedule where transactions run one after another without interleaving).
Conflict serializability is a common type of serializability. A schedule is conflict serializable if it is conflict equivalent to a serial schedule. Two schedules are conflict equivalent if the relative order of any two conflicting operations is the same in both schedules.
Conflicting operations are operations from different transactions on the same data item where at least one of the operations is a write operation. There are three types of conflicts:
To determine if a schedule is conflict serializable, we can construct a precedence graph (also called a serializability graph). The steps are as follows:
If the graph is acyclic, any topological sort of the graph nodes represents a valid serial order that is conflict equivalent to the given schedule.
Schedule S1: $r_1(X); r_2(X); w_1(X); r_3(X); w_2(X)$
Transactions involved: $T_1, T_2, T_3$. Data item: $X$.
Let's identify conflicting operations and the corresponding edges:
Precedence Graph for S1:
Cycle Check: The graph contains the edges $T_1 \to T_2$ and $T_2 \to T_1$. This forms a cycle $T_1 \to T_2 \to T_1$.
Conclusion for S1: Since the precedence graph contains a cycle, Schedule S1 is not conflict serializable.
Schedule S2: $r_2(X); r_1(X); w_2(X); r_3(X); w_1(X)$
Transactions involved: $T_1, T_2, T_3$. Data item: $X$.
Let's identify conflicting operations and the corresponding edges:
Precedence Graph for S2:
Cycle Check: The graph contains the edges $T_1 \to T_2$ and $T_2 \to T_1$. This forms a cycle $T_1 \to T_2 \to T_1$.
Conclusion for S2: Since the precedence graph contains a cycle, Schedule S2 is not conflict serializable.
Schedule S3: $r_3(X); r_2(X); r_1(X); w_2(X); w_1(X)$
Transactions involved: $T_1, T_2, T_3$. Data item: $X$.
Let's identify conflicting operations and the corresponding edges:
Precedence Graph for S3:
Cycle Check: The graph contains the edges $T_1 \to T_2$ and $T_2 \to T_1$. This forms a cycle $T_1 \to T_2 \to T_1$.
Conclusion for S3: Since the precedence graph contains a cycle, Schedule S3 is not conflict serializable.
Schedule S4: $r_2(X); w_2(X); r_3(X); r_1(X); w_1(X)$
Transactions involved: $T_1, T_2, T_3$. Data item: $X$.
Let's identify conflicting operations and the corresponding edges:
Precedence Graph for S4:
Cycle Check: The graph has edges $T_2 \to T_3$ and $T_3 \to T_1$, forming a path $T_2 \to T_3 \to T_1$. It also has an edge $T_2 \to T_1$. There is no path starting and ending at the same node. The graph is acyclic.
Conclusion for S4: Since the precedence graph is acyclic, Schedule S4 is conflict serializable. A possible equivalent serial schedule is $T_2 \to T_3 \to T_1$, which respects all dependencies.
Based on the precedence graph analysis, schedules S1, S2, and S3 contain cycles in their precedence graphs, meaning they are not conflict serializable. Schedule S4 has an acyclic precedence graph, indicating that it is conflict serializable.
| Schedule | Operations | Conflict Edges | Precedence Graph Edges | Cycle? | Conflict Serializable? |
|---|---|---|---|---|---|
| S1 | $r_1(X); r_2(X); w_1(X); r_3(X); w_2(X)$ | RW($T_2, T_1, X$), WR($T_1, T_3, X$), WW($T_1, T_2, X$), RW($T_3, T_2, X$) | $T_2 \to T_1$, $T_1 \to T_3$, $T_1 \to T_2$, $T_3 \to T_2$ | Yes ($T_1 \to T_2 \to T_1$) | No |
| S2 | $r_2(X); r_1(X); w_2(X); r_3(X); w_1(X)$ | RW($T_1, T_2, X$), WR($T_2, T_3, X$), WW($T_2, T_1, X$), RW($T_3, T_1, X$) | $T_1 \to T_2$, $T_2 \to T_3$, $T_2 \to T_1$, $T_3 \to T_1$ | Yes ($T_1 \to T_2 \to T_1$) | No |
| S3 | $r_3(X); r_2(X); r_1(X); w_2(X); w_1(X)$ | RW($T_3, T_2, X$), RW($T_2, T_1, X$), RW($T_1, T_2, X$), RW($T_3, T_1, X$), WW($T_2, T_1, X$) | $T_3 \to T_2$, $T_2 \to T_1$, $T_1 \to T_2$, $T_3 \to T_1$ | Yes ($T_1 \to T_2 \to T_1$) | No |
| S4 | $r_2(X); w_2(X); r_3(X); r_1(X); w_1(X)$ | WR($T_2, T_3, X$), WR($T_2, T_1, X$), WW($T_2, T_1, X$), RW($T_3, T_1, X$) | $T_2 \to T_3$, $T_2 \to T_1$, $T_3 \to T_1$ | No | Yes |
Understanding serializability is crucial in database concurrency control. Conflict serializability is a sufficient, but not necessary, condition for serializability. Another type is view serializability.
Consider the following statements:
Statement I: Conservative 2 PL is a deadlock-free protocol.
Statement II: Thomas's write rule enforces conflict serializability.
Statement III: Timestamp ordering protocol ensures serializability based on the order of transaction timestamps.
Which of the following is correct?
Consider the following schedules involving two transactions.
S 1: r 1(X) ; r 1(Y) ; r 2(X) ; r 2(Y) ; w 2(Y) ; w 1(X)
S2 : r 1(X) ; r 2(X) ; r 2(Y) ; w 2(Y) ; r 1(Y) ; w 1(X)
Which one of the following statements is correct with respect to above?Suppose a database schedule 5 involves transactions T 1, T 2, .............T nConsider the precedence graph of S with vertices representing the transactions and edges representing the conflicts. If S is serializable, which one of the following orderings of the vertices of the precedence graph is guaranteed to yield a serial schedule ?