Download presentation
Presentation is loading. Please wait.
Published byAspen Dixie Modified over 9 years ago
1
Kyoung-Hwan Yun (#110)
2
Conflicts Precedence Graphs and a Test for Conflict- Serializability
3
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
Non-conflicting situations: r i (X); r j (Y) will never conflict, even if X = Y. r i (X); w i (Y) will not conflict for X ≠ Y. w i (X); r j (Y) will not conflict for X ≠ Y. w i (X); w j (Y) will not conflict for X ≠ Y.
5
Three situations where actions may not be swapped: Two actions of the same transactions always conflict r i (X); w i (Y)
6
Three situations where actions may not be swapped: Two writes of the same database element by different transactions conflict w i (X); w j (X)
7
Three situations where actions may not be swapped: A read and a write of the same database element by different transaction conflict r i (X); w j (X) w i (X); r j (X)
8
Two actions of different transactions may be swapped unless: They involve the same database element, AND At least one is a write.
9
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
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
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 graph: Nodes represent transactions of S Arc from node i to node j if T i < S T j
13
Acyclic Conflict-serializable Example Schedule S: r 2 (A); r 1 (B); w 2 (A); r 3 (A); w 1 (B); w 3 (A); r 2 (B); w 2 (B); T3T1T2 Precedence Graph
14
Cyclic Not conflict-serializable Example Schedule S: r 2 (A); r 1 (B); w 2 (A); r 2 (B); r 3 (A); w 1 (B); w 3 (A); w 2 (B); Precedence Graph T1T2T3
15
A schedule is conflict-serializable if and only if its precedence graph is acyclic.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.