Timestamp based concurrency

concurrencytimestamptransaction

I am wondering if someone could help me out with a question I have about time stamp based concurrency.

I found the following practice problem on a website

It basically asks which of the following 4 will occur for the LAST transaction:

(a) the request is accepted.

(b) the request is ignored.

(c) the transaction is delayed.

(d) the transaction is rolled back.

The stands for the order of the time stamps and the = read = write

st1; st2; r2(A); co2; r1(A); w1(A)

The solution they give is choice (d) which had me kind of confused as to how they are coming to that. I may be mistaken about how the time stamps work but I thought that if a transaction wishes to access a shared variable it must have the earliest time stamp. In this example transaction 2 tries to read(A) first but I thought that should be delayed (since transaction 1 has the earlier of the 2 time stamps. So once we get to the r1(A), w1(A) since transaction 1 has the earlier stamp that should succeed as I understand it so I'm not sure why they choose (d). If I am misunderstanding the concept could someone please explain it to me I would greatly appreciate it.

Best Answer

"Transaction T can read or write data item X only if X had not been accessed by a "later" transaction. Otherwise, the operation of T is rejected; T is aborted and restarted with new TS".

In other words we have:

ST1 and then ST2 any data that is read or write by T2, could not be access by T1 or it will rollback that is because T2 start after T1.

I found it here in the slide 28

I hope it helped you