Conflicting operations ------------------------ Two operations conflict with each other, if they are by two different transactions and one of them is a write operation r1(x) w2(x) w1(x) r2(x) w1(x) w2(x) Serializability: ----------------------------- A schedule S is serializable (equal to a serial schedule) iff all conflicting operations in S occur in the same order as a serial schedule. Checking Serializability: ---------------------------- Create a conflict graph for a schedule S: -- Each transaction is a node -- For each conflict in S of the form: ri(x) wj(x) wi(x) rj(x) wi(x) wj(x) Draw an edge from Ti to Tj. T1->T2, T2->T1 If the resulting graph has a cycle, then this schedule is NOT serializable. If the resulting graph has no cycles, then this schedule is serializable. I can order transaction using topological sort on the conflict graph. Examples: S1: r1(x) r1(y) w2(y) w2(z) r3(z) w3(k) r1(k) w2(l) w1(x) S1': r1(x) r1(y) w2(y) w2(z) r3(z) r1(k) w3(k) w2(l) w1(x)