Timestamp Based Concurrency Control
Timestamp Based Concurrency Control
Concurrency Control can be implemented in different ways. One way to implement it is by using Locks. Now, lets
discuss about Time Stamp Ordering Protocol.
As earlier introduced, Timestamp is a unique identifier created by the DBMS to identify a transaction. They are
usually assigned in the order in which they are submitted to the system. Refer to the timestamp of a
transaction T as TS(T). For basics of Timestamp you may refer here.
Timestamp Ordering Protocol –
The main idea for this protocol is to order the transactions based on their Timestamps. A schedule in which the
transactions participate is then serializable and the only equivalent serial schedule permitted has the transactions in
the order of their Timestamp Values. Stating simply, the schedule is equivalent to the particular Serial
Order corresponding to the order of the Transaction timestamps. Algorithm must ensure that, for each items
accessed by Conflicting Operations in the schedule, the order in which the item is accessed does not violate the
ordering. To ensure this, use two Timestamp Values relating to each database item X.
• W_TS(X) is the largest timestamp of any transaction that executed write(X) successfully.
• R_TS(X) is the largest timestamp of any transaction that executed read(X) successfully.
From <https://www.geeksforgeeks.org/timestamp-based-concurrency-control/>
Every transaction is issued a timestamp based on when it enters the system. Suppose, if an old transaction T i has
timestamp TS(Ti), a new transaction Tj is assigned timestamp TS(Tj) such that TS(Ti) < TS(Tj).The protocol manages
concurrent execution such that the timestamps determine the serializability order. The timestamp ordering protocol
ensures that any conflicting read and write operations are executed in timestamp order. Whenever some
Transaction T tries to issue a R_item(X) or a W_item(X), the Basic TO algorithm compares the timestamp
of T with R_TS(X) & W_TS(X) to ensure that the Timestamp order is not violated. This describe the Basic TO
protocol in following two cases.
From <https://www.geeksforgeeks.org/timestamp-based-concurrency-control/>
From <https://www.javatpoint.com/dbms-timestamp-ordering-protocol>
• TS protocol ensures freedom from deadlock that means no transaction ever waits.
• But the schedule may not be recoverable and may not even be cascade - free.
From <https://www.javatpoint.com/dbms-timestamp-ordering-protocol>
From <https://www.geeksforgeeks.org/timestamp-based-concurrency-control/>
RDBMS Page 1
RDBMS Page 2