Dbms 2
Dbms 2
ON TIMESTAMP ORDERING
TIMESTAMP
• The idea for this scheme is to enforce the equivalent serial order on
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 order of their timestamp values.
This is called timestamp ordering (TO).
• The timestamp ordering algorithm works by assigning a unique
timestamp to each transaction when it arrives in the system. The
timestamp reflects the transaction's start time, and it is used to order
the transactions for execution.
The algorithm associates with each database item X two timestamp
(TS) values:
a. If read_TS(X) > TS(T) or if write_TS(X) > TS(T), then abort and roll
back T and reject the operation. This should be done because some
younger transaction with a timestamp greater than TS(T)—and
hence after T in the timestamp ordering—has already read or
written the value of item X before T had a chance to write X, thus
violating the timestamp ordering.
b. If the condition in part (a) does not occur, then execute the write_item(X)
operation of T and set write_TS(X) to TS(T).
• Whenever a transaction T issues a read_item(X) operation, the
following check is performed:
a. If write_TS(X) > TS(T), then abort and roll back T and reject the
operation. T his should be done because some younger transaction
with timestamp greater than TS(T)—and hence after T in the
timestamp ordering—has already written the value of item X before
T had a chance to read X.
If read_TS(X) > TS(T), then abort and roll back T and reject
the operation.
If write_TS(X) > TS(T), then do not execute the write
operation but continue processing.
If neither the condition in part (1) nor the condition in part (2) occurs,
then execute the write_item(X) operation of T and set write_TS(X) to
TS(T).
THANK YOU