Write a note on conflict serializability.
Conflict serializability
- Instructions li and lj of transactions Ti and Tj respectively, conflict if and only if there exists some item Q accessed by both li and lj, and at least one of these instructions wrote Q.
- If li and lj access different data item then li and lj don’t conflict.
- li = read(Q), lj = read(Q). li and lj don’t conflict.
- li = read(Q), lj = write(Q). li and lj conflict.
- li = write(Q), lj = read(Q). li and lj conflict.
- li = write(Q), lj = write(Q). li and lj conflict.
- Intuitively, a conflict between li and lj forces a (logical) temporal order between them.
- If a schedule S can be transformed into a schedule S´ by a series of swaps of non-conflicting instructions, we say that S and S´ are conflict equivalent.
- We say that a schedule S is conflict serializable if it is conflict equivalent to a serial schedule.
Example
- Schedule S can be transformed into Schedule S’ by swapping of non-conflicting series of instructions. Therefore Schedule S is conflict serializable.
Schedule S |
T1 |
T2 |
read(A) |
|
write(A) |
|
|
read(A) |
|
write(A) |
read(B) |
|
write(B) |
|
|
read(B) |
|
write(B) |
Schedule S' |
T1 |
T2 |
read(A) |
|
write(A) |
|
read(B) |
|
write(B) |
|
|
read(A) |
|
write(A) |
|
read(B) |
|
write(B) |
- Instruction Ii of transaction T1 and Ij of transaction T2 conflict if both of these instruction access same data A and one of these two instructions performs write operation on that data (A).
- • In above example the write(A) instruction of transaction T1 conflict with read(A) instruction of transaction T2 because both the instructions access same data A. But write(A) instruction of transaction T2 is not conflict with read(B) instruction of transaction T1 because both the instructions access different data. Transaction T2 performs write operation in A and transaction T1 is reading B.
- So in above example in schedule S two instructions read(A) and write(A) of transaction T2 and two instructions read(B) and write(B) of transaction T1 are interchanged and we get schedule S’.
- Therefore Schedule S is conflict serializable.
Schedule S’’ |
T3 |
T4 |
read(Q) |
|
|
write(Q) |
write(Q) |
|
- We are unable to swap instructions in the above schedule S’’ to obtain either the serial schedule < T3, T4 >, or the serial schedule < T4, T3 >.
- So above schedule S’’ is not conflict serializable.