Lecture 14
Lecture 14
T2
T3
T4
T5
UNDO: T2, T3
Last Checkpoint
REDO:
Active transactions: T2, T3
UNDO: T3, T5
T4 Commits
REDO: T2, T4
Move T4 to REDO
T1 T2 • T1 and T2 read X,
both modify it, then
Read(X) both write it out
X = X - 5 • The net effect of T1
and T2 should be no
Read(X) change on X
X = X + 5 • Only T2’s change is
Write(X) seen, however, so the
Write(X) final value of X has
COMMIT increased by 5
COMMIT
T1 T2 • T1 doesn’t change
the sum of X and Y,
Read(X) but T2 sees a change
X = X - 5 • T1 consists of two
parts – take 5 from X
Write(X) and then add 5 to Y
Read(X) • T2 sees the effect of
Read(Y) the first, but not the
Sum = X+Y second
Read(Y)
Y = Y + 5
Write(Y)
Transactions and Recovery
Next Lecture
• Concurrency
• Locks and resources
• Deadlock
• Serialisability
• Schedules of transactions
• Serial & serialisable schedules
• For more information
• Connolly and Begg chapter 20
• Ullman and Widom 8.6