Serializable:
• This is used to maintain the consistency of the database.
• It is mainly used in the Non-Serial scheduling to verify whether the
scheduling will lead to any inconsistency or not.
• On the other hand, a serial schedule does not need the serializability
because it follows a transaction only when the previous transaction is complete.
• The non-serial schedule is said to be in a serializable schedule only
when it is equivalent to the serial schedules, for an n number of transactions.
Since concurrency is allowed in this case thus, multiple transactions
can execute concurrently.
• A serializable schedule helps in improving both resource utilization
and CPU throughput.
Conflict Schedule:
Two operations are said to be conflicting if all conditions satisfy:
They belong to different transactions
They operate on the same data item
At Least one of them is a write operation
Example:
• Conflicting operations pair (R1(A), W2(A)) because they belong to two different
transactions on same data item A and one of them is write operation.
• Similarly, (W1(A), W2(A)) and (W1(A), R2(A)) pairs are also conflicting.
• On the other hand, (R1(A), W2(B)) pair is non-conflicting because they operate
on different data item.
• Similarly, ((W1(A), W2(B)) pair is non-conflicting.
Test whether the schedule are Conflict Equivalent Schedule ?
S1 = R1(A), R2(B), W1(A), W2(B)
S2 = R2(B), R1(A), W2(B), W1(A)
S1 S2
T1 T2 T1 T2
R(A) R(B)
R(B) R(A)
W(A) W(B)
W(B) W(A)
S1 = No Conflict Schedule
S2 = No Conflict Schedule
So, S1 = S2, Conflict Equivalent Schedule
Test whether the schedule are Conflict Equivalent Schedule ?
S1 = R1(A), W1(A), R2(B), W2(B), R1(B)
S2 = R1(A), W1(A), R1(B), R2(B), W2(B)
S1 S2
T1 T2 T1 T2
R(A) R(A)
W(A) W(A)
R(B) R(B)
W(B) R(B)
R(B) W(B)
S1 = Conflict Schedule
S2 = Conflict Schedule
So, S1 ≠ S2, Not Conflict Equivalent Schedule
Test whether the schedule are Conflict Equivalent Schedule ?
S1 = R2(A), R1(A), W2(B), W1(B)
S2 = R1(A), R2(A), W2(B), W1(B)
S1 S2
T1 T2 T1 T2
R(A) R(A)
R(A) R(A)
W(B) W(B)
W(B) W(B)
S1 = Conflict Schedule
S2 = Conflict Schedule
So, S1 = S2, Conflict Equivalent Schedule, Conflict Order is T2->T1
T1 T2
R(A)
W(A)
R(A)
W(A)
R(B)
W(B)
R(B)
W(B)
Conflict Serializable :
A schedule is called conflict serializable if it can be transformed into
a serial schedule by swapping non-conflicting operations.
Conflict Serializable :
S1≠S2, Because, Operation order in S1 is R1(B)->W2(B),
But Operation order in S2 is W1(B)->R2(B)
S1≠S3, Because, Operation order in S1 is W1(A)->R2(A),
But Operation order in S2 is W2(A)->R1(A)
T1 T2 T3 T4
R(X)
There is No Cycle, W(X)
So this is Conflict Serializable.
Apply Topological Sort, W(Y)
Serializability Order is, T1-T2-T3-T4 R(Y)
W(Z)
R(X)
R(Y)
There is No Cycle,
So this is Conflict Serializable.
Apply Topological Sort,
Serializability Order is, T1-T4-T3-T2