## What is Schedule?

The schedule is defined as the chronological order in which the instruction of the transactions will be executed.

## Example of Schedule

The following sequence of operations is a schedule. Moreover, we find two transactions T1 and T2, that are executing concurrently.

This schedule decides the actual series of operations which are prevailing to be implemented on the database.

T1 T2
Write (P)
Write (Q)

## Serial Schedule

A schedule is said to be serial if transactions are executed serially one after the other.

Let us suppose that T1 and T2 are the two transactions. A schedule containing T1 and T2 is said to be serial if either of the two conditions is true.

1. Executes all operations of T1 and then performs all operations of T2, as shown in figure (a).
2. Executes all operations of T2 and then performs all operations of T1, as shown in figure (b).

## Non-Serial Schedule

A schedule is said to be non-serial if the operation of each transaction is executed non-consecutively with inter-leaved operation from the other transaction.

Consider the schedule given in figure (c), which is a non-serial schedule.

## Difference between Serial Schedule and Non-Serial Schedule

Serial Schedule Non-Serial Schedule
A serial schedule is a series of operations by a set of concurrent transactions that maintains the order of operations in each of the single transactions. A non-serial schedule is a schedule wherever the functioning of a set of concurrent dealing are interlaced.
Transactions are implemented in serial order. Transactions are implemented in non-serial order, but the outcome should be similar to serial.
There is no interference among transactions. Concurrency problems can arise here.
The serial schedule provides the advantage of concurrent execution without any problem. In this schedule, there is no advantage of concurrent execution.
Serial schedule that does interleave the aspect of different transactions. The non-serial schedule has no only fixed aspect of any transaction.
Example: If some transaction T is long, another transaction should wait for T to finish all its operations. Example: In this schedule, the execution of another transaction goes on without waiting for the implementation of T.

## What is Serializability?

The serializable schedule is a schedule that succeeds a fixed of transactions to perform in a selected order like that the consequences are similar to imposing them in a few serial order like a serial schedule. The serial execution of transactions usually forgets the database in a consistent state.

Serializability defines the concurrent functions of various dealings. The goals of serializability are to determine the non-serial schedules that permit dealings to perform concurrently beyond interference with each other and there generating a record state that should be provided by the serial execution. Serializability should be authenticated to ensure inconsistency from a business dealing with interference with each other. The order of read and write process is essential in serializability.

## Testing of Serializability

The serialization diagram is utilized to check the serializability of the schedule.

Suppose a schedule S. For schedule S, generate a graph known as a precedence graph. It has a pair G = (V, E), where E contains a collection of edges, and V includes a selection of vertices. The collection of vertices includes all the transactions available within the S schedule. The set of edges consists of all edges Ti → Tj for which one of the following three conditions satisfy:

• Generate a node Ti → Tj given Ti transaction executes write (Q) before Tj transaction executes read (Q).
• Generate a node Ti → Tj given Ti transaction executes read (Q) before Tj transaction executes write (Q).
• Generate a node Ti → Tj given Ti transaction executes write (Q) before Tj transaction executes write (Q).

## Schedule S

Time Transaction T1 Transaction T2
T2 P:=P+50
T3 Write (P)
T5 P:=P+100
T6 Write (P)

In the above precedence graph of schedule S, contains two vertices Ti and Tj, and a single edge Ti → Tj, because all the instructions of Ti are executed before the first instruction of Tj is executed.

Given a precedence graph for each schedule includes a cycle, further that schedule is non-serializable. During the precedence, the structure has no cycle, and here the schedule is serializable.

The schedule S is serializable (i.e., serial schedule) during the precedence diagram has no cycle.

### Schedule S1

Time Transaction T1 Transaction T2
T3 Write (P)
T4 P:=P+50
T5 Write (P)

In above precedence graph of schedule S1, contains two vertices Ti and Tj, and edges Ti → Tj and Tj → Ti. In this Schedule S1, operations of Ti and Tj transactions are present in an interleaved manner.

The precedence graph contains a cycle; that is to say, schedule S1 is non-serializable.

Enroll Yourself in Live Training: DBMS Training