Timestamp Ordering Protocols in DBMS: Read/Write Rules, Worked Schedules and Exam Traps
Learn a mechanical ledger method for basic timestamp ordering, Thomas write rule and strict timestamp ordering, with checked schedules and comparison tables.
KnowledgeGate Team
Exam prep & CS education

Timestamp-ordering questions are often lost because a learner reverses older and newer, checks the wrong timestamp, or updates metadata after rejection. A mechanical method fixes this. Trace schedules mechanically and distinguish basic ordering, the Thomas write rule, and strict ordering.
Timestamp ordering in DBMS: the serial order is chosen first
A transaction receives a unique timestamp when it starts. Suppose TS(T1) = 5, TS(T2) = 10, TS(T3) = 20 and TS(T4) = 25. Smaller means older, so the intended serial order is T1 -> T2 -> T3 -> T4, even if operations arrive differently.
Every item X stores two metadata values:
R_TS(X): the largest timestamp among transactions whose reads ofXwere accepted.W_TS(X): the timestamp of the transaction whose accepted write most recently produced the current version.
These timestamps are not the value of X. If schedules or serialisability need revision first, use Transactions & Concurrency Control in DBMS. Timestamp ordering then fits naturally into the wider GATE CS Exam Preparation path.
Basic timestamp ordering rules: test before changing anything
For read_T(X), abort T if TS(T) < W_TS(X). Otherwise, accept and set R_TS(X) = max(R_TS(X), TS(T)). An older transaction cannot read a newer transaction's value without reversing the serial order.
For write_T(X), check R_TS(X) first. Abort if TS(T) < R_TS(X); otherwise abort if TS(T) < W_TS(X); otherwise write and set W_TS(X) = TS(T).
Operation | Reject when | Action when accepted | Metadata update |
|---|---|---|---|
|
| Return current |
|
|
| Replace |
|
Equality is accepted because the tests use <, not <=. A rejected read, an aborted write, or a Thomas-ignored write changes neither the data nor its timestamps.
Basic timestamp ordering worked schedule
Start with X = 100, R_TS(X) = 0, W_TS(X) = 0, and execute r2(X); w1(X = 110); w3(X = 140); r2(X); r4(X).
Operation | Before | Comparison | Decision and value | After |
|---|---|---|---|---|
|
|
| Accept, return |
|
|
|
| Abort |
|
|
|
| Accept, write |
|
second |
|
| Abort |
|
|
|
| Accept, return |
|
The final state is X = 140, R_TS(X) = 25, W_TS(X) = 20. T1 and T2 abort. Neither rejection updates metadata.

Thomas write rule: ignore only a safely obsolete write
Take fresh item Y = 50, R_TS(Y) = 0, W_TS(Y) = 0. T3 has timestamp 20; its w3(Y = 90) passes both tests, so Y = 90 and W_TS(Y) = 20. Now T2, timestamp 10, attempts w2(Y = 70).
The read-timestamp test 10 < 0 is false, but 10 < 20 is true. Basic ordering aborts T2. Thomas instead ignores the obsolete write, keeps T2 active, and leaves Y = 90, R_TS(Y) = 0, W_TS(Y) = 20. In timestamp order, T3 would overwrite T2 before a later observer needed its value.
The relaxation has a firm boundary. If T4 first reads Y, then R_TS(Y) = 25. The later w2(Y = 70) must abort because 10 < 25. Thomas never ignores a violation of R_TS.

Strict timestamp ordering and recoverability
Basic ordering enforces timestamp order without waiting, so it is deadlock-free, but it can expose an uncommitted write. Strict ordering delays a conflicting read or write until the earlier writer commits or aborts, creating a strict, recoverable schedule.
Let Z = 500. T3, timestamp 20, writes Z = 540 but remains uncommitted. T4, timestamp 25, requests r4(Z). Basic checks allow it because 25 >= W_TS(Z) = 20. If T4 commits and T3 later aborts, the schedule is not recoverable because T4 read uncommitted data.
Strict ordering makes r4(Z) wait. If T3 commits, T4 reads 540; if T3 aborts, T4 reads restored value 500. Waiting follows older-to-newer dependencies. Repeated abort and restart can still cause starvation, so deadlock freedom is not starvation freedom.
Solve timestamp ordering schedules with a ledger
Use four steps:
Write every
TS(T)and initialiseR_TSandW_TSfor each item.Select the read or write rule before considering the desired answer.
Test comparisons in order, then update the ledger only after acceptance.
Track transaction status. Ignore later operations of an aborted transaction unless it restarts with a new timestamp.
Two diagnostic states clarify reads and writes. With TS(Ta) = 8, R_TS(Q) = 12, W_TS(Q) = 5, ra(Q) is accepted because 8 < 5 is false, and R_TS(Q) remains 12. Independently, wa(Q) aborts because 8 < 12.
Now use R_TS(Q) = 3, W_TS(Q) = 11. ra(Q) aborts because 8 < 11. Independently, wa(Q) passes 8 < 3, then basic ordering aborts it because 8 < 11; Thomas ignores that write. Finally, check that no lower-timestamp transaction overwrites a result already observed or written by a higher-timestamp one.
Timestamp ordering exam patterns and traps
Check | Basic TO | Thomas write rule | Strict TO |
|---|---|---|---|
Old read behind | Abort | Abort | Abort by timestamp rule |
Write behind | Abort | Abort | Abort |
Write behind only | Abort | Ignore obsolete write | Abort |
Uncommitted conflicting write | May be exposed | May be exposed | Access waits |
Recoverable by protocol | Not necessarily | Not necessarily | Yes |
Waiting and deadlock | No waiting, deadlock-free | No waiting, deadlock-free | Waits, but dependencies follow timestamps |
Repeated-restart starvation | Possible | Possible | Possible |
Common traps have exact corrections:
Trap | Correction |
|---|---|
Larger timestamp means older | Smaller timestamp means older |
Compare with the preceding transaction | Compare |
Check | Check |
Update after rejection or ignore | Make no data or metadata update |
Basic TO is automatically recoverable | It can expose an uncommitted value |
Thomas ignores every old write | It never ignores an |
Questions may ask which transaction aborts, the accepted-operation count, final timestamps, the Thomas outcome, or recoverability. KnowledgeGate has more than 10 practice questions on Timestamp Ordering Protocols. The linked DBMS Transaction MCQs: 12 Solved (ACID, Locking) focus on ACID and locking, while the schedules here drill timestamp-ledger decisions.
Timestamp ordering protocols: the short version and next step
Read aborts when
TS(T) < W_TS(X).Basic write aborts when
TS(T) < R_TS(X)orTS(T) < W_TS(X).Thomas ignores only the second obsolete-write case.
Strict TO waits before exposing an uncommitted conflicting write.
An accepted read takes the maximum R_TS; an accepted write sets W_TS; a rejected or ignored operation makes no update. Without looking back, reproduce these checkpoints: (X, R_TS, W_TS) = (140, 25, 20), the Thomas branch keeps Y = 90, W_TS(Y) = 20, and strict TO makes r4(Z) wait while T3 is uncommitted.
Once the ledger is automatic, use the GATE Test Series for timed mixed practice. If transactions, serialisability and recovery need rebuilding as one sequence, follow GATE Guidance by Sanchit Sir.
Keep learning
Timestamp Ordering Protocols MCQs: 12 Solved DBMS Questions with Explanations
Solve 12 timestamp ordering MCQs with step-by-step explanations. Practise basic timestamp traces, wait-die order, Thomas' Write Rule, and multiversion reads.
Two-Phase Locking and Timestamp Ordering for GATE: Recoverable and Cascadeless Schedules Solved
Classify one schedule as recoverable but not cascadeless, trace basic timestamp ordering against Thomas' Write Rule, and connect both results to strict 2PL.
SQL Subqueries and Correlated Subqueries: How to Read, Write and Solve Placement-Test Questions
Read nested SQL from the inside out, distinguish once-only and per-row evaluation, and solve common placement questions with one small employee dataset.
Python File Handling Basics: Modes, Read/Write Traces and Exam Traps
Learn a mechanical way to solve Python file questions: apply the mode first, track the cursor and newlines, then compute returned values and final contents.





