Skip to content

Timestamp-based concurrency control

wikipedia Timestamp-based concurrency control

In computer science, a timestamp-based concurrency control algorithm is a non-lock concurrency control method. It is used in some databases to safely handle transactions, using timestamps.

Operation

Formal

Each transaction ({\displaystyle T_{i}}T_{i}) is an ordered list of actions ({\displaystyle A_{ix}}A_{{ix}}). Before the transaction performs its first action ({\displaystyle A_{i1}}A_{{i1}}), it is marked with the current timestamp, or any other strictly totally ordered sequence: {\displaystyle TS(T_{i})=NOW()}TS(T_{i})=NOW(). Every transaction is also given an initially empty set of transactions upon which it depends, {\displaystyle DEP(T_{i})=[]}DEP(T_{i})=[], and an initially empty set of old objects which it updated, {\displaystyle OLD(T_{i})=[]}OLD(T_{i})=[].

Each object {\displaystyle (O_{j})}(O_{j}) in the database is given two timestamp fields which are not used other than for concurrency control: {\displaystyle RTS(O_{j})}RTS(O_{j}) is the time at which the value of object was last used by a transaction, {\displaystyle WTS(O_{j})}WTS(O_{j}) is the time at which the value of the object was last updated by a transaction.

For all {\displaystyle T_{i}}T_{i}:

To abort: