What are Schedules ?
Schedules are sequences that indicate the chronological order in which instructions of concurrent transactions are executed.
A schedule must preserve the order in which the instructions appear in each individual transaction.
Types of schedule
- Serial schedule
- Non serial schedule
Example of serial schedule
Transaction2 starts after completion of transaction1.
Example of non serial schedule
Transaction2 start while transaction1 was in process.
Sometimes a transaction may be incomplete due to a software issue, system crash or hardware failure.
Than failed transaction needed to be rollback.
A transaction needed to be saved at each point.
In SQL we use commit to save the transactions state.
This example uses commit at proper point, which maked it recoverable schedule. In case of fail it can be roll back to commit point.
Example of Schedule recoverability
|X = 1000|
|Read(X);||X = 10000||X = 10000|
|X=X-1000;||X = 9000||X = 10000|
|Write(X);||X = 9000||X = 9000|
|Read(X);||X = 9000||X = 9000|
|X=X+1000;||X = 10000||X = 9000|
|Write(X);||X = 10000||X = 10000|