A precedence graph, also named conflict graph[1] and serializability graph, is used in the context of concurrency control in databases.[2] It is the directed graph representing precedence of transactions in the schedule, as reflected by precedence of conflicting operations in the transactions. A schedule is conflict-serializable if and only if its precedence graph of committed transactions is acyclic. The precedence graph for a schedule S contains:
Cycles of committed transactions can be prevented by aborting an undecided (neither committed, nor aborted) transaction on each cycle in the precedence graph of all the transactions, which can otherwise turn into a cycle of committed transactions (and a committed transaction cannot be aborted). One transaction aborted per cycle is both required and sufficient in number to break and eliminate the cycle (more aborts are possible, and can happen under some mechanisms, but are unnecessary for serializability). The probability of cycle generation is typically low, but, nevertheless, such a situation is carefully handled, typically with a considerable amount of overhead, since correctness is involved. Transactions aborted due to serializability violation prevention are restarted and executed again immediately.
A precedence graph of the schedule D, with 3 transactions. As there is a cycle (of length 2; with two edges) through the committed transactions T1 and T2, this schedule (history) is not Conflict serializable. Notice, that the commit of Transaction 2 does not have any meaning regarding the creation of a precedence graph.
Algorithm to test Conflict Serializability of a Schedule S along with an example schedule.
[math]\displaystyle{ S = \begin{bmatrix} T1 & T2 & T3 \\ R(A) & & \\ & W(A) & \\ & Com. & \\ W(A) & & \\ Com. & & \\ & & W(A)\\ & & Com.\\ \end{bmatrix} }[/math]
[math]\displaystyle{ S = R1(A) }[/math] [math]\displaystyle{ W2(A) }[/math] [math]\displaystyle{ Com.2 }[/math] [math]\displaystyle{ W1(A) }[/math] [math]\displaystyle{ Com.1 }[/math] [math]\displaystyle{ W3(A) }[/math] [math]\displaystyle{ Com.3 }[/math]
el:Γράφος Σειριοποιησιμότητας ru:Граф предшествования
Original source: https://en.wikipedia.org/wiki/Precedence graph.
Read more |