/    /  DBMS- Thomas’ Write Rule

Thomas’ Write Rule

 

The modification to the timestamp-ordering  protocol is known as ‘Thomas Write rule’ :

 

There is no change in performing the ‘read’ operation.

 

Suppose the Ti issues ‘write(Q)’ :

(a) If TS(Ti) < RTS(Q), then the value of Q that Ti is producing, was previously needed, and it had been assumed that the value would never be produced. After rejecting the write operation, the system rolls Ti back.

(b) If TS(Ti) < W-TS(Q), then Ti is attempting to write an obsolete value of Q and it can be ignored.

(c) Otherwise, the system executes the write operation and sets W-TS(Q) to TS(Ti).

EXAMPLE-1 :

Consider the following schedule :

T27T28
Read (Q)
write(Q)
Write (Q)

 

Here, T27 < T28. The execution of ‘read(Q)’ of T27 operation succeeds. 

The execution of ‘write(Q)’ of T28 operation also succeeds.

 

Here,  it is clear that     

  • TS(T27) < W-TS(Q) 
  • W-TS(Q) = TS(T28).

 

As per TSOP, when T27 attempts to do the ‘write(Q)’ operation, the ‘write(Q)’ operation by T27 is rejected and T27 must be rolled back.

 

Here, since T28 has already written Q, the value that T27 is attempting to write is one that will never need to be read.

i.e., Any transaction Ti with TS(Ti) < TS(T28) that attempts a read(Q) will be rolled back, since TS(Ti) < W-TS(Q).

 

And any transaction Tj with TS(Tj) > TS(T28) must read the value of Q written by T28 rather than the value that T27 is attempting to write.

 

This observation leads to a modified version of TSOP, in which obsolete write operations can be ignored under certain circumstances.

 

The protocol rules for read operations remain unchanged. The protocol rules for write operations, however, are slightly different from the TSOP.

 

Reference Link

Thomas’ Write Rule