432 views
0 votes
0 votes

Consider the following scenarios:

The possible values of P and Q allowed under Thomas Write Rule but not under basic time stamp ordering protocol if TS(T2) > TS(T1)

(a) W(B), W(C)                 (b) W(A), W(A)

(c) Both (A) and (B)                (d) None of these

1 Answer

0 votes
0 votes
Option A

Thomas Write Rule:

Transaction Ti issues a Read then below condition should be checked.

If (TS(Ti) < WTS(Q)), Ti would read a value of Q that was already overwritten by a newer transaction Tj <> Ti . Hence, this read is rejected and Ti will be rolled back.

If TS(Ti) ≥ WTS(Q), the read is approved, and we set RTS(Q) := max{RTS(Q),TS(Ti)}Data item A.

Transaction Ti issues a Write then below condition should be checked.

If(RTS(Q)>TS(Ti)) THEN rollback.

If(TS(Ti) < WTS(Q)) THEN Ignore the write and continue the transaction else

 

Initially RTS =0, WTS=0 For all Data Items.

1. Read request by Transaction T1 R(A), after applying above condition seems to be true,

    then RTS=1,WTS=0

2. Read request by Transaction T1 R(B), after applying above conditions seems to be true,

   then RTS=1,WTS=0

3. Read request by Transaction T1 R(C), after applying above conditions seems to be true,

   then RTS=1,WTS=0

4. Again Read request by Transaction T2 R(A)

    RTS =1,WTS=0 ,when read done by transaction T1 ,RTS and WTS updated

    after applying the condition for Read request made by Transaction T2,

    then RTS = 2 ,WTS=0 updated.

5. Again Read request by Transaction T2 R(B)

    RTS =1,WTS=0 ,when read done by transaction T1 ,RTS and WTS updated

    after applying the condition for Read request made by Transaction T2,

    then RTS = 2 ,WTS=0 updated.

6.I am choosing the Option A, W(B) request made by transaction T2,

   As of now RTS =2,WTS=0, now apply the condition for write request

   RTS = 2,WTS= 2 and it is successfully because the conditions seems true, So write request is been granted.

7.Write request W(C) in option A by Transaction T1,

   As of now RTS=1,WTS=0 , now apply the condition

   RTS = 1,WTS =1 and it seems true ,so write request is granted.

8.Read request made by Transaction T2 R(C)

   As of now RTS =1, WTS=1 , now apply the condition

   RTS= 2,WTS=2 and it seems to be true ,so read request is granted.

By this Option A is correct ,Similarly Check For Option B.

So W(A) write request by Transaction T2 is granted but W(A) request made by transaction T1 is not granted.

So A option.

No related questions found