1 / 11

Conflict-Serializability (section 18.2 of Concurrency Control)

Conflict-Serializability (section 18.2 of Concurrency Control). - Amith KC Student ID – 006498310. Overview. One of the sufficient conditions to assure that a schedule is serializable is “ conflict-serializability ”. Idea of Conflicts. Conflicting and non-conflicting actions.

dallon
Download Presentation

Conflict-Serializability (section 18.2 of Concurrency Control)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Conflict-Serializability (section 18.2 of Concurrency Control) - Amith KC Student ID – 006498310

  2. Overview • One of the sufficient conditions to assure that a schedule is serializable is “conflict-serializability”. • Idea of Conflicts. • Conflicting and non-conflicting actions. • Conflict-equivalent and conflict-serializability schedules. • Precedence Graphs • Definition. • Test for conflict-serializability.

  3. Conflicts • Definition • is a pair of consecutive actions in a schedule such that, if their order is interchanged, then the behavior of at least one of the transactions involved can change. • Non-conflicting actions: Let Ti and Tjbe two different transactions (i ≠ j), then: • ri(X); rj(Y) is never a conflict, even if X = Y. The reason is that neither of thesesteps change the value of any database element. • ri(X); wj(Y) is not a conflict provided X ≠ Y. • wi(X); rj(Y) is not a conflict provided X ≠ Y. • Similarly, wi(X); wj(Y) is also not a conflict, provided X ≠ Y.

  4. continued… • Three situations of conflicting actions (where we may not swap their order) • Two actions of the same transaction. • e.g., ri(X);wi(Y) • Two writes of the same database element by different transactions. • e.g., wi(X);wj(X) • A read and a write of the same database element by different transactions. • e.g., ri(X);wj(X) • To summarize, any two actions of different transactions may be swapped unless: • They involve the same database element, and • At least one of them is a write operation.

  5. continued… • Conflict-equivalent schedules: • Two schedules are called conflict-equivalent schedules if they can be turned one into the other by a sequence of non-conflicting swaps of adjacent actions. • Conflict-serializability schedule: • A schedule is conflict-serializable if it is conflict-equivalent to a serial schedule. Conflict Serializability is not required for a schedule to be serializable, but it is the condition that the schedulers in commercial systems generally use when they need to guarantee serializablity.

  6. Precedence Graphs • Conflicting pairs of actions (of a schedule S) put constraints on the order of transactions in the hypothetical, conflict-equivalent serial schedule. • For a schedule S, involving transactions T1 and T2(among other transactions), we say that T1 takes precedence over T2 (written as T1 <s T2)if there are actions A1 of T1 and A2 of T2, such that: • A1 is ahead of A2 in S, • Both A1 and A2 involve the same database element, and • At least one of them is a write operation.

  7. continued… • The precedences mentioned in the previous slide can be depicted in a “precedence graph”. • The nodes in this graph are the transactions of the schedule S. • Example of a precedence graph: • Consider a schedule S which involves three transactions T1, T2 and T3, i.e., S: r2(A); r1(B); w2(A); r3(A); w1(B); w3(A); r2(B); w2(B); The precedence graph for this as is shown below: 1 2 3 Figure 1

  8. Test for conflict-serializability • Construct the precedence graph for S and observe if there are any cycles. • If yes, then S is not conflict-serializable • Else, it is a conflict-serializable schedule. • Example of a cyclic precedence graph: • Consider the below schedule S1: r2(A); r1(B); w2(A); r2(B); r3(A); w1(B); w3(A); w2(B); The precedence graph for this as shown below: 1 2 3 Figure 2

  9. continued… • Observing the actions of A in the previous example (figure 2), we can find that T2 <s1 T3. • But when we observe B, we get both T1 <s1 T2 and T2 <s1 T1. Thus the graph has a cycle between 1 and 2. So, based on this fact we can conclude that S1 is not conflict-serializable.

  10. Why the Precedence-Graph test works • A cycle in the graph puts too many constraints on the order of transactions in a hypothetical conflict-equivalent serial schedule. • If there is a cycle involving n transactions T1 T2 ..Tn T1 • Then in the hypothetical serial order, the actions of T1 must precede those of T2 which would precede those of T3... up to n. • But actions of Tn are also required to precede those of T1. • So, if there is a cycle in the graph, then we can conclude that the schedule is not conflict-serializable.

  11. Thank you!

More Related