0% found this document useful (0 votes)
4 views

Timestamp Based Protocol for Cc

Chapter 15 discusses timestamp-based protocols for concurrency control in database systems, where each transaction is assigned a timestamp to determine the order of execution. The protocol maintains two timestamps for each data item: W-timestamp for the latest successful write and R-timestamp for the latest successful read. It ensures that conflicting operations are executed in timestamp order, rejecting operations that violate this order and rolling back transactions as necessary.

Uploaded by

prosm2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Timestamp Based Protocol for Cc

Chapter 15 discusses timestamp-based protocols for concurrency control in database systems, where each transaction is assigned a timestamp to determine the order of execution. The protocol maintains two timestamps for each data item: W-timestamp for the latest successful write and R-timestamp for the latest successful read. It ensures that conflicting operations are executed in timestamp order, rejecting operations that violate this order and rolling back transactions as necessary.

Uploaded by

prosm2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 6

Chapter 15 : Concurrency Control

Database System Concepts, 6th Ed.


©Silberschatz, Korth and Sudarshan
See www.db-book.com for conditions on re-use
Timestamp-Based Protocols

 Each transaction is issued a timestamp when it enters the system. If


an old transaction Ti has time-stamp TS(Ti), a new transaction Tj is

assigned time-stamp TS(Tj) such that TS(Ti) <TS(Tj).

 The protocol manages concurrent execution such that the time-stamps


determine the serializability order.

 In order to assure such behavior, the protocol maintains for each data
Q two timestamp values:

 W-timestamp(Q) is the largest time-stamp of any transaction that


executed write(Q) successfully.

 R-timestamp(Q) is the largest time-stamp of any transaction that


executed read(Q) successfully.

Database System Concepts - 6th Edition 15.2 ©Silberschatz, Korth and Sudarshan
Timestamp-Based Protocols (Cont.)

 The timestamp ordering protocol ensures that any conflicting read


and write operations are executed in timestamp order.

 Suppose a transaction Ti issues a read(Q)

1. If TS(Ti)  W-timestamp(Q), then Ti needs to read a value of Q


that was already overwritten.

 Hence, the read operation is rejected, and Ti is rolled back.

2. If TS(Ti)  W-timestamp(Q), then the read operation is


executed, and R-timestamp(Q) is set to max(R-timestamp(Q),
TS(Ti)).

Database System Concepts - 6th Edition 15.3 ©Silberschatz, Korth and Sudarshan
Timestamp-Based Protocols (Cont.)

 Suppose that transaction Ti issues write(Q).

1. If TS(Ti) < R-timestamp(Q), then the value of Q that Ti is


producing was needed previously, and the system assumed that
that value would never be produced.

 Hence, the write operation is rejected, and Ti is rolled back.

2. If TS(Ti) < W-timestamp(Q), then Ti is attempting to write an


obsolete value of Q.

 Hence, this write operation is rejected, and Ti is rolled back.

3. Otherwise, the write operation is executed, and W-timestamp(Q)


is set to TS(Ti).

Database System Concepts - 6th Edition 15.4 ©Silberschatz, Korth and Sudarshan
T26: read(B);
T25: read(B); B := B − 50;
read(A); write(B);
display(A + B). read(A);
A := A + 50;
write(A);
display(A + B).

TS(T25) < TS(T26)


Database System Concepts - 6th Edition 15.5 ©Silberschatz, Korth and Sudarshan
Example Use of the Protocol
A partial schedule for several data items for transactions with
timestamps 1, 2, 3, 4, 5

Database System Concepts - 6th Edition 15.6 ©Silberschatz, Korth and Sudarshan

You might also like