What is Serializability, View Serializability and Conflict Serializability

 

What is Serializability?

Serializability of schedules ensures that a non-serial schedule is equivalent to a serial schedule. It helps in maintaining the transactions to execute simultaneously without interleaving one another. In simple words, serializability is a way to check if the execution of two or more transactions are maintaining the database consistency or not.

  • Serializability is a concurrency scheme where the concurrent transaction is equivalent to one that executes the transactions serially.
  • A schedule is a list of transactions.
  • Serial schedule defines each transaction is executed consecutively without any interference from other transactions.
  • Non-serial schedule defines the operations from a group of concurrent transactions that are interleaved.
  • In non-serial schedule, if the schedule is not proper, then the problems can arise like multiple update, uncommitted dependency and incorrect analysis.
  • The main objective of serializability is to find non-serial schedules that allow transactions to execute concurrently without interference and produce a database state that could be produced by a serial execution.

1. Conflict Serializability

  • Conflict serializability defines two instructions of two different transactions accessing the same data item to perform a read/write operation.
  • It deals with detecting the instructions that are conflicting in any way and specifying the order in which the instructions should execute in case there is any conflict.
  • A conflict serializability arises when one of the instruction is a write operation.
The following rules are important in Conflict Serializability,

1. If two transactions are both read operation, then they are not in conflict.

2. If one transaction wants to perform a read operation and other transaction wants to perform a write operation, then they are in conflict and cannot be swapped.

3. If both the transactions are for write operation, then they are in conflict, but can be allowed to take place in any order, because the transactions do not read the value updated by each other.

2. View Serializability

  • A schedule will view serializable if it is view equivalent to a serial schedule.
  • If a schedule is conflict serializable, then it will be view serializable.
  • The view serializable which does not conflict serializable contains blind writes.

View Equivalent

Two schedules S1 and S2 are said to be view equivalent if they satisfy the following conditions:

1. Initial Read

An initial read of both schedules must be the same. Suppose two schedule S1 and S2. In schedule S1, if a transaction T1 is reading the data item A, then in S2, transaction T1 should also read A.


DBMS View Serializability

Above two schedules are view equivalent because Initial read operation in S1 is done by T1 and in S2 it is also done by T1.

2. Updated Read

In schedule S1, if Ti is reading A which is updated by Tj then in S2 also, Ti should read A which is updated by Tj.

DBMS View Serializability

Above two schedules are not view equal because, in S1, T3 is reading A updated by T2 and in S2, T3 is reading A updated by T1.

3. Final Write

A final write must be the same between both the schedules. In schedule S1, if a transaction T1 updates A at last then in S2, final writes operations should also be done by T1.


DBMS View Serializability

Above two schedules is view equal because Final write operation in S1 is done by T3 and in S2, the final write operation is also done by T3.

Example:


DBMS View Serializability

Schedule S

With 3 transactions, the total number of possible schedule

  1. 3! = 6  
  2. S1 = <T1 T2 T3>  
  3. S2 = <T1 T3 T2>  
  4. S3 = <T2 T3 T1>  
  5. S4 = <T2 T1 T3>  
  6. S5 = <T3 T1 T2>  
  7. S6 = <T3 T2 T1>  

Taking first schedule S1:


DBMS View Serializability

Schedule S1

Step 1: final updation on data items

In both schedules S and S1, there is no read except the initial read that's why we don't need to check that condition.

Step 2: Initial Read

The initial read operation in S is done by T1 and in S1, it is also done by T1.

Step 3: Final Write

The final write operation in S is done by T3 and in S1, it is also done by T3. So, S and S1 are view Equivalent.

The first schedule S1 satisfies all three conditions, so we don't need to check another schedule.

Hence, view equivalent serial schedule is:

  1. T1    →      T2    →    T3  

Post a Comment

© DBMS. The Best Codder All rights reserved. Distributed by