Database Reference
In-Depth Information
Execute read operation. Set Read-timestamp(D) to the larger of Read-
timestamp(D) and Timestamp(T).
(2) T issues write(D)
(a) Timestamp(T) < Read-timestamp(D)
T asks to write D that has already been read by a younger or later transaction.
This means that a later transaction is already using the value of D and it would
be incorrect to update D now. T is too late to attempt to write D.
Reject write operation. Abort T and restart it with a new timestamp.
(b) Timestamp(T) > Write-timestamp(D)
T asks to write D that has been updated by a younger or later transaction. This
means that T is attempting to override the value of D with an obsolete value.
Reject write operation. Abort T and restart it with a new timestamp.
(c) Otherwise, when (a) and (b) are not true
Execute write operation. Set Write-timestamp(D) to Timestamp(T).
To illustrate the basic timestamp-ordering protocol, let us consider two transac-
tions T1 and T2 concurrently accessing savings and checking account records.
T1 wants to read the two records, add the balances, and display the total. T2 intends
to transfer $1,000 from a savings account to a checking account. Assume that T2 is
submitted after T1 so that Timestamp(T1) < Timestamp(T2). Figure 15-25 presents
the functioning of the timestamp-ordering protocol.
The basic timestamp-ordering protocol ensures conflict serializability. It produces
results that are equivalent to a serial schedule where transactions are executed in
their chronological order. In other words, the executions of operations would be as
though all operations of one transaction are executed first, followed by all opera-
tions of another transaction that are executed next, and so on, with no interleaving
of operations. A modification of the basic timestamp-ordering protocol affords
greater potential for concurrency. We discuss this in the next subsection.
Thomas's Write Rule Consider concurrent transactions T1 and T2 accessing data
item D. Assume that T1 starts earlier than T2 so that Timestamp(T1) < Time-
Transaction T1
Execution under timestamp
ordering protocol
T1
READ (SAV)
READ (CHK)
SUM :
TIME
T1
T2
CHK
SAV
SUM
=
(CHK)
+
(SAV)
t1
READ (SAV)
2000
15000
DISPLAY SUM
t2
READ (SAV)
2000
15000
t3
(SAV) : = (SAV) - 1000
2000
15000
t4
WRITE (SAV)
2000
14000
Transaction T2
t5
READ (CHK)
2000
14000
t6
READ (CHK)
2000
14000
T2
READ (SAV)
(SAV) :
t7
SUM :
=
(CHK)
+
(SAV)
17000
t8
DISPLAY SUM
=
(SAV)
-
1000
t9
(CHK) : = (CHK) + 1000
2000
14000
WRITE (SAV)
READ (CHK)
(CHK) : = (CHK) + 1000
WRITE (CHK)
SUM : = (CHK) + (SAV)
DISPLAY SUM
t10
WRITE (CHK)
3000
14000
t11
SUM : = (CHK) + (SAV)
17000
t12
DISPLAY SUM
Figure 15-25
Timestamp-ordering protocol.
Search WWH ::




Custom Search