King Saud University

advertisement
King Saud University
College of Computer and Information Sciences
Information Technology Department
IT 331
Sheet 3
Transaction Management and Serializability (deadlock – timestamp)
3. Apply the following techniques on each of the below schedules and determine, for
each technique, which transaction(s) is/are going to be aborted and which
operation(s) will be rejected.
a. Basic Timestamp Ordering.
b. Basic Timestamp Ordering with Thomas's Write Rule.
c. Multi-version Timestamp Ordering
S2
BeginTrans1
Read1(x)
BeginTrans2
BeginTrans3
Read3(x)
Write3(x)
Read2(y)
Read3(z)
Write3(z)
Commit3
Write1(z) a) T1 abort and roll back with new timestamp (because some younger
transaction (T3) with greater timestamp has write the value of Z before T1) b) Ignores
the write operation No because there is a read3(Z) before so the T1 should aborts c)
abort T1
Read2(z) a) T2 abort and roll back with new timestamp (because some younger
transaction (T3) with greater timestamp has write the value of Z before T1) b) same as a
Write2(z)c) abort T2
Read1(y)
Commit2
Write1(y)
Commit1
Item
Write_TS
Read_TS
X
3
13
Y
Z
2
3
3
1
Additional example to show when Thomas's write Rule makes different
S4
Read1(x)
Write1(x)
Read2(y)
Write2(y)
Write2(z)
Write1(z) a) T1 abort and roll back with new timestamp (because some younger
transaction (T2) with greater timestamp has write the value of Z before T1) b) Ignores
the write operation
4.
<T1 Start>
<T1,B,15,80> ' Updated B from 15 to 80
<T2 Start>
<T2,A,0,20> ' Updated A from 0 to 20
<checkpoint>
<T2,B,80,60>
<T2 Commit>
<T3 Start>
<T1,A,20,15>
<T1 Commit>
<T3,C,12,24>
<T3,D,100,90>
<T3 Commit>
<T4 Start>
<T4,B,60,90>
<checkpoint>
<T5 Start>
<T5,E,5, 0>
<T7 Start>
<T7,F,20,40>
<T7 Commit>
<T6 Start>
<T6,F,40, 0> ,
<T6 Commit>
System failure
Using Deferred Updates recovery scheme,
(a) Which transactions will be undone? none
(b) Which transactions will be redone? T6, T7
(c) What will be the values of A, B, C, D, E and F after recovering the system?
A=15, B=60 C=24, D=90, E=5, F=0
Using Immediate Updates recovery scheme,
(a) Which transactions will be undone? T4, T5
(b) Which transactions will be redone? T6, T7
2
(c) What will be the values of A, B, C, D, E and F after recovering the system?
A=15, B=60, C=24, D=60, E=5, F=0
3
Download