Time Stamp Protocol

It says a very basic rule that if a transaction Tj that enters after Ti then TimeStamp(Ti) < TimeStamp(Tj) which means that producing schedule must be equivalent to a serial schedule Ti->Tj.
In Time Stamp Protocol ensures that any conflicting read and write operations are executed in time stamp order
if not such an operation is rejected and transaction will be rolled back.
The rolled back transaction will be restarted with a new Time Stamp.

T1T2
Read(A)
Write(A)
Write(A)

Here you could see that conflict is occurring between T2->T1 and it is given that Time Stamp (T1) < Time Stamp (T2)
which means it the generated conflict must be resolved in T1->T2. But which is not possible so we rollback transaction T1.

Thomos Write Rule

We allow write-write conflict by ignoring.
T1T2
Read(A)
Write(A)
Write(A)
Note The conflict occurred says T1->T2 and it is given that Time Stamp (T2) < Time Stamp (T1) which means it the conflict can’t be resolved but
Thomos write rule says that we can ignore the write done by T1 as it has been overwritten by T2 later.
Example 1
The above two arrows are showing conflict of type Read-Write.
Time Stamp (T1) < Time Stamp (T2), this is already given and conflicts are saying T1 -> T2. So we are good.
Example 2
It is given that Time Stamp (T2) < Time Stamp (T3) so according to Time Stamp T2 -> T3 should be there.
But the conflict says it should be T3 -> T2
And is also not allowed in Thomos write Rule as well.
Advantages
1. Serializability
2. Ensures freedom from dead lock

Disadvantage
Starvation may occur due to continuously getting aborted and restarting the transaction.


Quantitative Aptitude
Reasoning
Programming
Interview