Serializability

COMP3311 20T3 ♢ Serializability ♢ [0/10]
❖ Serializability


Serializable schedule:

Abstracting this needs a notion of schedule equivalence.

Two common formulations of serializability:

COMP3311 20T3 ♢ Serializability ♢ [1/10]
❖ Conflict Serializability

Consider two transactions T1 and T2 acting on data item X.

Possible orders for read/write operations by T1 and T2:

T1 first   T2 first   Equiv?
R1(X) R2(X)   R2(X) R1(X)   yes
R1(X) W2(X)   W2(X) R1(X)   no
W1(X) R2(X)   R2(X) W1(X)   no
W1(X) W2(X)   W2(X) W1(X)   no

If T1 and T2 act on different data items, result is always equivalent.

COMP3311 20T3 ♢ Serializability ♢ [2/10]
❖ Conflict Serializability (cont)

Two transactions have a potential conflict if

In such cases, the order of operations affects the result.

If no conflict, can swap order without affecting the result.

If we can transform a schedule

then we say that the schedule is conflict serializible.
COMP3311 20T3 ♢ Serializability ♢ [3/10]
❖ Conflict Serializability (cont)

Example: transform a concurrent schedule to serial schedule

T1: R(A) W(A)      R(B)      W(B)
T2:           R(A)      W(A)      R(B) W(B)
swap
T1: R(A) W(A) R(B)           W(B)
T2:                R(A) W(A)      R(B) W(B)
swap
T1: R(A) W(A) R(B)      W(B)
T2:                R(A)      W(A) R(B) W(B)
swap
T1: R(A) W(A) R(B) W(B)
T2:                     R(A) W(A) R(B) W(B)

COMP3311 20T3 ♢ Serializability ♢ [4/10]
❖ Conflict Serializability (cont)

Checking for conflict-serializability:

Method for doing this:
COMP3311 20T3 ♢ Serializability ♢ [5/10]
❖ Conflict Serializability Example

Example schedule which is not conflict serializable:

T1: R(X)           R(Y) W(X)      W(Y)
T2:           R(X)           W(X)
T3:      R(X)                          W(X)
attempted swaps
T1:           R(X) W(X)          R(Y) W(Y)
T2:      R(X)           W(X)
T3: R(X)                     W(X)

Precendence graph for the above schedule:

[Diagram:Pics/xact/prec-graph.png]

COMP3311 20T3 ♢ Serializability ♢ [6/10]
❖ View Serializability

View Serializability is

As with CS, it is based on a notion of schedule equivalence The idea: if, across the two schedules ... then they are view equivalent
COMP3311 20T3 ♢ Serializability ♢ [7/10]
❖ View Serializability (cont)

Two schedules S and S' on T1 .. Tn are view equivalent iff

To check serializibilty of S ...
COMP3311 20T3 ♢ Serializability ♢ [8/10]
❖ View Serializability Example

Example: consider the following concurrent schedule

T1: R(A) W(A)      R(B)      W(B)
T2:           R(A)      W(A)      R(B) W(B)

If view serializable, the read/write behaviour must be like one of

  1. T1: R(A) W(A) R(B) W(B)
    T2:                     R(A) W(A) R(B) W(B)
    

  2. T1:                     R(A) W(A) R(B) W(B)
    T2: R(A) W(A) R(B) W(B)
    

COMP3311 20T3 ♢ Serializability ♢ [9/10]
❖ View Serializability Example (cont)

Reminder of concurrent schedule

T1: R(A) W(A)      R(B)      W(B)
T2:           R(A)      W(A)      R(B) W(B)

In the concurrent schedule

In T1;T2 So, concurrent schedule is view equivalent to T1;T2
COMP3311 20T3 ♢ Serializability ♢ [10/10]


Produced: 15 Nov 2020