Serializability in DBMS

The main aim of multi user DBMS is to help in maximising the degree of concurrency in the system. But as the degree of concurrency increases there is a possibility that the system becomes inconsistent. This can be handled with Serializability in DBMS.

For instance, if we have transactions that access same parts of a database, then some concurrency control protocols are needed so that transactions can be scheduled in such a way that they do not interfere with each other.

Serializability in DBMS is the method which helps in identifying those executions of transactions that guarantee to ensure consistency in the database. but before understanding the concept of Serializability, we need to have knowledge about what a schedule actually is in DBMS.

Schedule – A Brief Introduction

Implementing Serializability is done using schedules. in DBMS During the execution of concurrent transactions if the order of operations in each individual transactions is preserved during their concurrent execution, then this is referred to as a schedule.

Let us consider an example. Say we have two transactions T1 and T2. Transaction T1 Transfers Rs. 100 from account A to account B. On the other hand, transaction T2 Transfer Rs. 200 from account B to account C.

The set of operations in these transactions would be as follows:

T1 T2
Read A
A = A – 100
Write A
Read B
B = B + 100
Write B
Read B
B= B – 200
Write B
Read C
C = C + 200
Write C

Now, let us have a look at some of the possible schedules for the above two transactions.

Schedules

When transactions are running concurrently the operations may conflict each other. Such operations are said to be conflicted. The conflicted operations must satisfy all of the following conditions:

  1. Operations must belong to different transactions.
  2. Operations must access the same data item.
  3. Write operation on the data must be performed by at least one of the operations.

In order to avoid conflicting operations, locking mechanism is applied.

Let us have a look at the types of schedules.

Schedules – Types

Serializability in DBMS

Serial Schedules

If operations of each transaction are executed consecutively without any interleaved operations, then the transactions are said to be in a serial schedule.

Non-Serial Schedules

In non-serial schedules, operations from a set of concurrent transactions are interleaved.

Main Aim of Serializability

The main aim of Serializability is basically to locate non serial schedules that allow transactions to execute concurrently. Such schedules are known as serializable schedules. The schedule 2 discussed above is an example of serializable schedule.

Important Points to be taken care of in Serializability

When ordering the read and write operations in Serializability we need to take care of the following points

  • In case both transactions are performing the read operation on a data item then they will not conflict and the order in which the operations are executed will not matter.
  • In case both transactions have completed the read or write operation on separate data items then they do not conflict and the order of their execution does not matter.
  • But if one transaction writes a data item and the other transaction either reads or writes the same date item then the order of execution of such operations is very important.

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *