Explain serial execution or transaction with an example(DBMS)

There are three possible ways in which a transaction can be executed. These are as follows −

  • Serial execution − In serial execution, the second transaction can begin its execution only after the first transaction has completed. This is possible on a uniprocessor system.

  • Parallel execution − In parallel execution, two transactions can start their execution at exactly the same instant of time. For this, we require more than one processor.

  • Concurrent execution − In concurrent execution, execution of the second process can begin even before the process has completed its execution.

Let us consider two transactions T1 and T2. In concurrent execution, the CPU executes some instructions of transaction T1, then moves to the second transaction and executes its instructions for some time and again it comes back to the first transaction.

The cycle is repeated until all the instructions of both the transactions are executed. The process is called context switching.


Given below is an example of serial execution −

Let us consider two transactions T1 and T2 where T1 performs transfer Rs.150 from account A to account B and similarly T2 transfers 10% of balance from A to B.

  T1               T2
  Read(A)        Read(A)
  A=A-150        temp =0.1 *A
  Write(A)       A=A-temp
  Read(B)        Write(A)
  B=B+150        Read(B)
  Write(B)      B=B+temp

The order in which the instructions of transaction T1 and T2 are executed is called a Schedule.

The possible serial schedules are as follows −

Let A= 200, B=200

Schedule S1 and S2 keeps the database in consistent state.

In general if the system consists of n number of transactions, then we can generate n! number of valid serial schedules.

Updated on: 06-Jul-2021

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started