Serial and Concurrent Schedule

What is a Schedule ?

Definition 1:
The order of the execution of the transactions is known as schedule.

Definition 2 :
The time order sequence of operations among transactions.

Two types of schedules

  • Serial schedule
  • Non serial schedule or concurrent schedule
Serial Schedule Concurrent Schedule
The transactions are completed one after another. For example, if there are 3 transactions T1, T2, T3, then, Firstly, T1 complete its execution. Then after the commit of T1 transaction, transaction T2 completes, and in the last T3 completes. Interleaved or simultaneous execution of two or more transaction is called concurrent schedule. In Concurrent Schedule, CPU time is being shared by different transactions.
Advantage : Every schedule is a serial schedule, So no problems of Isolation occurs. Advantage :
1.
If T1 needs DMA processor, CPU can execute T2. Hence Throughput increases.
2. Better Resource Utilization.3. Less Response Time.
Drawback :

1. THROUGHPUT of Transaction is less, since the CPU is idle if transaction needs IO.

Solution : Use Concurrent Schedule.

Drawback :

Problems of Isolation must be managed.

Example of serial schedule :

Serial Schedule Example - Serial and Concurrent Schedule

Example of Non Serial or Concurrent Schedule :

Non Serial Schedule Example - (Serial and Concurrent Schedule)

Some Questions on Serial Schedule and Concurrent Schedule :

Question 1 :
How many number of serial schedules can be formed with and transactions?
Solution : let us consider three transaction T1 T2 and T3.
Solution 1 - Serial and Concurrent Schedule
Question 2 :
 How many concurrent schedules can be formed using transaction T1 and T2 on n1 n2 operations respectively?
Solution :
Consider n1 = 2, and n2 = 2
For two transactions T1 and T2 :
Solution 2 - Serial and Concurrent Schedule
a) R1(X) W1(X) R2(X) W2(X)
b) R1(X) R2(X) W2(X) W1(X)
c) R1(X) R2(X) W1(X) W2(X)
d) R2(X) W2(X) R1(X) W1(X)
e) R2(X) R1(X) W1(X) W2(X)
f) R2(X) R1(X) W2(X) W1(X)

Therefore 6 Schedules = (4!) / ( 2! 2!) = 4C2
Therefore, with n1 and n2 Operations :
(n1 + n2)! / (n1! . n2!)
Question 3 :
 How many concurrent schedules can be formed using 3 transactions on n1, n2, n3, entry operations respectively?
Solution :
(n1 + n2 + n3)! / (n1! . n2! . n3!)
Question 4 :
 Assume there are M transactions and number of operations in the transactions are n1, n2, n3,...,nm. How many number of non serial schedules can be formed?
Solution :
The number of non Serial Schedules formed will be :
(n1 + n2 + n3 + .... + nm)! / (n1! . n2! . n3! .... nm!)
Question 5 :
 Assume there are two transactions T1 and T2. T1 contains 2 operations T2 and to contains 5 operations. Find the number of serial and non serial schedules?
Solution :
Number of Serial Schedules = 2
Number on Concurrent/Nonserial Schedules = (2+5)! / (2! . 5!) =21
Question 6 :
 Let there are three transactions T1, T2, T3. T1 contains M operations, T2 contains N operations, T3 contains P operations. Find the total schedule possible?
Solution :
(m + n + p)! / (m! . n! . p!)

We can also write as :

(m+n+p)Cm * (n+p)Cn * pCp

Previous Home Next
ACID Properties Concurrency Problems in Transaction

     

Incoming search terms:

  • concurrent schedule in dbms
  • types of schedule in dbms
  • serial schedule
  • schedule in dbms
  • concurrent schedule
  • non serial schedule example
  • Serial and concurrent schedule
  • serial schedule advantage
  • example of serial schedule in rdbms
  • define serial shedule and non serial shedule dbms

Leave a Reply