1 / 15

18.2 Conflict- Serializability

18.2 Conflict- Serializability. Kyoung-Hwan Yun (#110). 18.2 Conflict- Serializability. Conflicts Precedence Graphs and a Test for Conflict- Serializability. Conflicts.

lok
Download Presentation

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. 18.2 Conflict-Serializability Kyoung-Hwan Yun (#110)

  2. 18.2 Conflict-Serializability • Conflicts • Precedence Graphs and a Test for Conflict-Serializability

  3. 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. Conflicts • Non-conflicting situations: • ri(X); rj(Y) will never conflict, even ifX = Y. • ri(X); wi(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. Conflicts • Three situations where actions may not be swapped: • Two actions of the same transactions always conflictri(X); wi(Y)

  6. Conflicts • Three situations where actions may not be swapped: • Two writes of the same database element by different transactions conflictwi(X); wj(X)

  7. Conflicts • Three situations where actions may not be swapped: • A read and a write of the same database element by different transaction conflictri(X); wj(X)wi(X); rj(X)

  8. Conflicts • Two actions of different transactions may be swapped unless: • They involve the same database element, AND • At least one is a write.

  9. Conflicts • 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.

  10. Conflicts • Example of conflict-serializable schedule; schedule is converted to the serial schedule (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); 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);r1(A); w1(A); r1(B); w1(B); r2(A); w2(A); r2(B); w2(B);

  11. Precedence Graphs and a Test for Conflict-Serializability • Given a schedule S, involving transactions T1 and T2, T1 takes precedence over T2 (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 A1 and A2 is a write action. • These are exactly the conditions under which we cannot swap the order of A1 and A2. Therefore, a conflict-equivalent serial schedule must have T1 before T2.

  12. Precedence Graphs and a Test for Conflict-Serializability • Precedence graph: • Nodes represent transactions of S • Arc from node i to node j if Ti <STj

  13. Precedence Graphs and a Test for Conflict-Serializability Acyclic  Conflict-serializable Example Schedule S: r2(A); r1(B); w2(A); r3(A); w1(B); w3(A); r2(B); w2(B); Precedence Graph T1 T2 T3

  14. Precedence Graphs and a Test for Conflict-Serializability Cyclic  Not conflict-serializable Example Schedule S: r2(A); r1(B); w2(A); r2(B); r3(A); w1(B); w3(A); w2(B); Precedence Graph T1 T2 T3

  15. Precedence Graphs and a Test for Conflict-Serializability A schedule is conflict-serializableif and only if its precedence graph is acyclic.

More Related