Schedules And Its Types
When there are multiple transactions running, and the order of execution is needed, then, schedules come into the picture. So that operations do not overlap with each other.
In simple words, schedules define the order of the operation of each transaction.
Types of Schedules in DBMS
1. Serial Schedules
Schedules in which no transaction can start until a running transaction is ended are called serial schedules.
Example: Consider the following schedules (A and B), each holding two transactions, T1 and T2. In Serial schedule, two transactions execute separately. They cannot execute at the same time as given below
This is a serial schedule since the transactions perform serially in the order T1 —> T2 OR T2 —> T1
Advantage of Serial Schedule
The main benefit of a serial schedule is that there is no concurrency problem.
Disadvantage of Serial Schedule
It is a time-wasting approach because if T1, T2, T3 arrive at the same time, then T2, T3 have to wait until T1 is completed.
In further lectures, we will deal with parallel scheduling, not serial scheduling, because time is the money.
2. Non-Serial (Parallel) Schedule
In the non-serial schedule, the other transaction proceeds without waiting for the previous transaction to complete. Non-serial schedules can be of two types.
- Non-Serializable Schedule.
Example: The following schedules are non-serial, where T1 and T2 are running concurrently.
- The operations of T1 and T2 are interleaved.
- So, the following schedules are examples of a non-serial schedule.
Our Need is parallel transactions because of time saving but parallel cause the Concurrency problem and Read write Conflict problem.
Explanation With Real Life Example
- If there exist one ATM machine then only one person can widraw the money at a time other persons has to wait. It is a serial schedule.
- By using online application of any bank, thousands of people can send and receive the money at a time. It is a parallel schedule
Difference Between Serial & Parallel Schedule
|Only one transaction execute at a time
|More than one transaction execute at a time
|No concurrency problem
|Concurrency problem in some cases