Thursday, 14 April 2016

Serial Schedules in Database Transactions

Serial Schedules in Database Transactions, what is serial schedule?, Example for serial schedules, Define serial schedule


Serial Schedule


Schedule - A schedule is a list of operations (read, write, commit, abort, checkpoint, calculation – we mostly consider the read and write operations) that are performed by various concurrently (simultaneous) executing set of transactions. For further information refer the Transaction Schedules page.

Serial Schedule - A serial schedule is a schedule in which all the instructions belong to a transaction complete before the other transactions. That is, the transactions are executed one after the other without interleaving.

For example, assume that a schedule S with two transactions, namely, T1 and T2. If all the instructions of T1 are executed before T2 or all the instructions of T2 are executed before T1, then S is said to be a serial schedule.

Example:

Table 1, 2, and 3 show some examples of serial schedules.
In schedule S1, T1 completes before T2.
Transaction T1
Transaction T2
read(A);
A := A – 5;
write(A);
read(B);
B := B – 5;
write(B);






read(A);
temp := A * 0.1;
A := A – temp;
write(A);
read(B);
B := B + temp;
write(B);
Table 1: Schedule S1

In schedule S2, the execution order is T3, T1, T2
Transaction T1
Transaction T2
Transaction T3








read(A);
A := A – 5;
write(A);
read(B);
B := B + 5;
write(B);














read(A);
temp := A * 0.1;
A := A – temp;
write(A);
read(B);
B := B + temp;
write(B);
read(C);
temp1 := C * 0.5;
C := C + temp1;
write(C);
read(D);
temp2 := D * 0.5;
D := D + temp1;
write(D);

Table 2: Schedule S2

In schedule S3, T2 completes before T1.
Transaction T1
Transaction T2







read(A);
A := A – 5;
write(A);
read(B);
B := B – 5;
write(B);
read(A);
temp := A * 0.1;
A := A – temp;
write(A);
read(B);
B := B + temp;
write(B);
Table 3: Schedule S3

 *******************



Go to Transaction Management in DBMS home page









No comments:

Post a Comment

SQL exercises for beginners one

SQL Exercises for Beginners / Simple SQL Exercises with Answers / Solved SQL exercises / SQL solved exercises with simple conditions / So...