written 8.6 years ago by | • modified 8.6 years ago |
Mumbai University > Information Technology > Sem 3 > Database Management System
Marks: 10 M
Year: Dec 2014
written 8.6 years ago by | • modified 8.6 years ago |
Mumbai University > Information Technology > Sem 3 > Database Management System
Marks: 10 M
Year: Dec 2014
written 8.6 years ago by | • modified 8.5 years ago |
1. Introduction:
i. A schedule is called as a serial schedule when the operations of each transaction are executed consecutively, without any interleaved operations from the other transaction.
ii. Formally, a schedule S is serial if, for every transaction T participating in the schedule, all the operations of T are executed consecutively in the schedule; otherwise, the schedule is called nonserial.
2. Explanation:
i. Suppose, two railway reservation agents perform two transactions T1 and T2 at approximately same time.
ii. If no interleaving of operations is permitted, there are only two possible outcomes:
They can be diagrammatically represented as:
T1 | T2 |
---|---|
read(A), | - |
A:= A-N, | - |
Write(A), | - |
read(B), | - |
B:=B+N, | - |
write(B) | - |
- | read(A), |
- | A=A+M, |
- | write(A) |
Table 1: Serial Schedule A T1 followed by T2
T1 | T2 |
---|---|
- | read(A), |
- | A=A+M, |
- | write(A) |
read(A), | - |
A:=A-N, | - |
Write(A), | - |
read(B), | - |
B:=B+N, | - |
write(B) | - |
Table 2: Serial Schedule B T2 followed by T1
iii. The concept of serializability of schedules is used to identify which schedules are correct when transaction executions have interleaving of their operations in the schedules.
iv. Thus, a schedule S of n transactions is serializable if it is equivalent to some serial schedule of the same n transactions.
v. There are n! possible serial schedules of n transactions and many more possible nonserial schedules.
3. Types of Serializability
I. Conflict Serializability
T1 | T2 |
---|---|
read(A), | - |
write(A) | - |
- | read(A) |
- | write(A) |
read(B) | - |
write(B) | - |
- | read(B) |
- | write(B) |
The write (A) instruction of T1 conflicts with the read(A) instruction of T2. However, the write (A) instruction of T2 does not conflict with the read(B) instruction of T1, because the two instructions access different data items.
T1 | T2 |
---|---|
read(A), | - |
write(A) | - |
- | read(A) |
read(B) | - |
- | write(A) |
write(B) | - |
- | read(B) |
- | write(B) |
T1 | T2 |
---|---|
read(A), | - |
write(A) | - |
read(B) | - |
write(B) | - |
- | read(A) |
- | write(A) |
- | read(B) |
- | write(B) |
Thus, a serial schedule is generated. If a schedule S can be transformed into a schedule S’ by a series of swaps of nonconflicting instructions, we say that S and S’ are conflict equivalent. A schedule S is conflict serializable if it is conflict equivalent to a serial schedule.
II. View Serializability
T1 | T2 |
---|---|
read(Q) | - |
- | write(Q) |
write(Q) | - |
T1 | T2 | T3 |
---|---|---|
read(Q) | - | - |
- | read(Q) | - |
write(Q) | - | - |
- | - | write(Q) |
Thus, the above mentioned schedule is view equivalent to a serial schedule <t1, t2,="" t3="">, since the one read(Q) instruction reads the initial value of Q in both schedules, and T3 performs the final write of Q in both schedules.