Check whether two schedules are view equal or not(DBMS)


There are two types of serializability which are as follows −

View serializability

A schedule is view-serializability if it is view equivalent to a serial schedule.

The rules it follows are given below −

  • T1 is reading the initial value of A, and then T2 also reads the initial value of A.

  • T1 is the reading value written by T2, and then T2 also reads the value written by T1.

  • T1 is writing the final value, and then T2 also has the write operation as the final value.

Conflict serializability

It orders any conflicting operations in the same way as some serial execution. A pair of operations is said to conflict if they operate on the same data item and one of them is a write operation.

That means,

  • Readi(x) readj(x) - non conflict read-read operation

  • Readi(x) writej(x) - conflict read-write operation.

  • Writei(x) readj(x) - conflict write-read operation.

  • Writei(x) writej(x) - conflict write-write operation.

Now let us find out whether the schedules are view equal or not.

A schedule is view-serializability, if it is view equivalent to a serial schedule. A schedule is view serializable, if following three rules are satisfied −

  • Rule 1 − if Ti reads data initially, after this Tj writes the same data, in the given schedule. This sequence must be followed in the transaction combination (read write operation).

  • Rule 2 − if Ti writes data initially, after this Tj reads the same data, in the given schedule. This sequence must be followed in the transaction combination (write read operation).

  • Rule 3 − if Ti writes data, after this Tj writes the data finally. This sequence must be followed in the transaction combination (write-write operation).

Example

R1(X) W2(X) W1(X), create all possible combinations of the transactions. We have 2 transactions, so the combinations are− <T1, T2> and <T2, T1>.

  • Rule 1 − T1 reads initially, after this T2 writes the same data, that means the transaction sequence must be “T1 followed by T2”. So remove following combination where “T1 is not followed by T2” i.e. <T2, T1>

  • Rule 2 − T2 writes initially, after this no transaction reads the same data. So we keep all the transaction combinations, that means rule 2 does not remove any combinations.

  • Rule 3 − T1 writes data finally, that means T1 must occur at last, so remove following combinations where “t1 does not occur at last”. <T1, T2>

Hence, no combination left to satisfy the view serializability.

Conclusion

The given schedule is not view-serializable.

Updated on: 08-Jul-2021

291 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements