written 6.3 years ago by |
A schedule is serializable if it is equivalent to a serial schedule.
• Conflict serializability:
o Instructions Ii and Ij, of transactions Ti and Tj respectively, conflict if and only if there exists some item P accessed by both Ii and Ij, and atleast one of these instructions wrote P.
o Consider the below operations-
i. Ii = read(P), Ij = read(P). Ii and Ij don’t conflict.
ii. Ii = read(P), Ij = write(P). They conflict.
iii. Ii = write(P), Ij = read(P). They conflict.
iv. Ii = write(P), Ij = write(P). They conflict.
• A conflict between Ii and Ij forces a temporal order between them.
• If Ii and Ij are consecutive in a schedule and they do not conflict, their results would remain the same even if they had been interchanged in the schedule.
• If a schedule Scan be transformed in to a schedule S by a series of swaps of non-conflicting instructions, then S and S` are conflict equivalent.
• In other words a schedule S is conflict serializable if it is conflict equivalent to a serial schedule.
• Example of a schedule that is not conflict serializable:
T3 | T4 |
---|---|
Read(P) | |
Write(P) | |
Write(P) |
• The instructions cannot be swapped in the above schedule to obtain either the serial schedule < T 3 , T 4 >, or the serial schedule < T 4 ,T 3 >.
• A serial schedule T2 follows T1, by a series of swaps of non-conflicting instructions making the below Schedule conflict serializable.
T1 | T2 |
---|---|
Read(X) | |
Write(X) | |
Read(X) | |
Write(X) | |
Read(Y) | |
Write(Y) | |
Read(Y) | |
Write(Y) |
• View serializability:
o S and S` are view equivalent if the following three conditions are met:
i. For each data item P, if transaction Ti reads the initial value of P in schedule S, then transaction Ti must, in schedule S`, also read the initial value of P.
ii. For each data item P, if transaction Ti executes read (P)in schedule S, and that value was produced by transaction Tj, then transaction Ti must in schedule S` also read the value of P that was produced by transaction Tj.
iii. For each data item P, the transaction that performs the final write(P) operation in schedule S must perform the final write(P) operation in schedule S`.
o View equivalence is also based purely on reads and writes alone.
o A schedule S is view serializable if it is ie w equivalent to a serial schedule.
o Every conflict serializable schedule is also view serializable.
o Every view serializable schedule which is not conflict serializable has blind writes.
T3 | T4 | T6 |
---|---|---|
Read(P) | ||
Write(P) | ||
Write(P) | ||
Write(P) |