Slideshow:
|
Graphically:
|
|
|
Graphically:
|
There are 2 possible consistent states:
Consistent state 1: A B
Consistent state 2: A-100 B+100
|
Transaction: transfer $100 from A to B
read A
A.balance = A.balance - 100
write A
================================== system fails here
|
Graphically:
|
The resulting database state is:
Database state = A-100 B |
Notice that:
|
T1 = Deposit $1 to A:
read A
A = A + 1
write A
|
|
T1 T2
=============================
read A Initially: A = 10
read A
A = A + 1
(A = 11)
A = A + 2
(A = 12)
write A Writes 11 to A
write A Writes 12 to A
|
Graphically:
|
|
|
|