Serializability in Transaction Control

What is serializability?

  • 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

  • View serializability is the another type of serializability.
  • It can be derived by creating another schedule out of an existing schedule and involves the same set of transactions.
Example : Let us assume two transactions T1 and T2 that are being serialized to create two different schedules SH1 and SH2, where T1 and T2 want to access the same data item. Now there can be three scenarios

1. If in SH1, T1 reads the initial value of data item, then in SH2 , T1 should read the initial value of that same data item.

2. If in SH2, T1 writes a value in the data item which is read by T2, then in SH2, T1 should write the value in the data item before T2 reads it.

3. If in SH1, T1 performs the final write operation on that data item, then in SH2, T1 should perform the final write operation on that data item.

If a concurrent schedule is view equivalent to a serial schedule of same transaction then it is said to be View serializable.