1 / 13

Concurrency Control 18.2 Conflict Serializability

Concurrency Control 18.2 Conflict Serializability. Geetha Ranjini Viswanathan ID: 121. 18.2 Conflict- Serializability. 18.2.1 Conflicts 18.2.2 Precedence Graphs and a Test for Conflict- Serializability 18.2.3 Why the Precedence-Graph Test Works.

kyrie
Download Presentation

Concurrency Control 18.2 Conflict Serializability

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. Concurrency Control18.2 Conflict Serializability GeethaRanjiniViswanathan ID: 121

  2. 18.2 Conflict-Serializability • 18.2.1 Conflicts • 18.2.2 Precedence Graphs and a Test for Conflict-Serializability • 18.2.3 Why the Precedence-Graph Test Works

  3. 18.2.1 Conflicts • Conflict -a pair of consecutive actions in a schedule such that, if their order is interchanged, the final state produced by the schedule is changed.

  4. 18.2.1 Conflicts • Non-conflicting situations: Assuming Ti and Tj are different transactions, i.e., i ≠ j: • ri(X); rj(Y) will never conflict, even if X = Y. • ri(X); wj(Y) will not conflict for X ≠ Y. • wi(X); rj(Y) will not conflict for X ≠ Y. • wi(X); wj(Y) will not conflict for X ≠ Y.

  5. 18.2.1 Conflicts • Two actions of the same transactions always conflictri(X); wi(Y) • Two writes of the same database element by different transactions conflictwi(X); wj(X) • A read and a write of the same database element by different transaction conflictri(X); wj(X)wi(X); rj(X) • Conflicting situations: Three situations where actions may not be swapped:

  6. 18.2.1 Conflicts • Conclusions: Any two actions of different transactions may be swapped unless: • They involve the same database element, and • At least one is a write • The schedules S and S’ are conflict-equivalent, if S can be transformed into S’ by a sequence of non-conflicting swaps of adjacent actions. • A schedule is conflict-serializable if it is conflict-equivalent to a serial schedule.

  7. 18.2.1 Conflicts • Example 18.6 Conflict-serializable schedule S: r1(A); w1(A); r2(A); w2(A); r1(B); w1(B); r2(B); w2(B); Above schedule is converted to the serial schedule S’ (T1, T2) through a sequence of swaps. r1(A); w1(A); r2(A); w2(A); r1(B); w1(B); r2(B); w2(B);r1(A); w1(A); r2(A); r1(B); w2(A); w1(B); r2(B); w2(B);r1(A); w1(A); r1(B); r2(A); w2(A); w1(B); r2(B); w2(B);r1(A); w1(A); r1(B); r2(A); w1(B); w2(A); r2(B); w2(B); S’: r1(A); w1(A); r1(B); w1(B); r2(A); w2(A); r2(B); w2(B);

  8. 18.2.2 Precedence Graphs and a Test for Conflict-Serializability • Given a schedule S, involving transactions T1 and T2, T1 takes precedence over T2 (T1 <sT2), if there are actions A1of T1 and A2of T2, such that: • A1 is ahead of A2 in S, • Both A1 and A2 involve the same database element, and • At least one of A1 and A2 is a write action • We cannot swap the order of A1 and A2. • A1 will appear before A2 in any schedule that is conflict-equivalent to S. • A conflict-equivalent serial schedule must have T1 before T2.

  9. 18.2.2 Precedence Graphs and a Test for Conflict-Serializability • Precedence graph: • Nodes represent transactions of S • Arc from node i to node j, if Ti <S Tj • Example 18.7 Given Schedule S: r2(A); r1(B); w2(A); r3(A); w1(B); w3(A); r2(B); w2(B); Precedence Graph Acyclic graph  Schedule is conflict-serializable T3 T1 T2

  10. 18.2.2 Precedence Graphs and a Test for Conflict-Serializability • Example 18.8 S: r2(A); r1(B); w2(A); r3(A); w1(B); w3(A); r2(B); w2(B); Convert S to serial schedule S’ (T1, T2, T3). r1(B); r2(A); w2(A); r3(A); w1(B); w3(A); r2(B); w2(B); r1(B); r2(A); w2(A); w1(B); r3(A); w3(A); r2(B); w2(B); r1(B); r2(A); w1(B); w2(A); r3(A); w3(A); r2(B); w2(B); r1(B); w1(B); r2(A); w2(A); r3(A); w3(A); r2(B); w2(B); r1(B); w1(B); r2(A); w2(A); r3(A); r2(B); w3(A); w2(B); r1(B); w1(B); r2(A); w2(A); r2(B); r3(A); w3(A); w2(B); r1(B); w1(B); r2(A); w2(A); r2(B); r3(A); w2(B); w3(A); r1(B); w1(B); r2(A); w2(A); r2(B); w2(B); r3(A); w3(A); S’: r1(B); w1(B); r2(A); w2(A); r2(B); w2(B); r3(A); w3(A);

  11. 18.2.2 Precedence Graphs and a Test for Conflict-Serializability • Example 18.9 Given Schedule S: r2(A); r1(B); w2(A); r2(B); r3(A); w1(B); w3(A); w2(B); Precedence Graph Cyclicgraph  Schedule is NOT conflict-serializable T1 T2 T3

  12. 18.2.3 Why the Precedence-Graph Test Works • Consider a cycle involving n transactions T1 —> T2 ... —> Tn —> T1 • In the hypothetical serial order, the actions of T1must precede those of T2, which precede those of T3, and so on, up to Tn. • But the actions of Tn, which therefore come after those of T1, are also required to precede those of T1. This puts constraints on legal swaps between T1 and Tn. • Thus, if there is a cycle in the precedence graph, then the schedule is not conflict-serializable.

  13. Questions?

More Related