Deadlock
A deadlock is a condition when two or more transactions are executing and each transaction is waiting for the other to finish but none of them are ever finished. So all the transactions will wait for infinite time and not a single transaction is completed.
Wound-Wait Scheme
In this scheme, if a transaction requests to lock a resource (data item), which is already held with conflicting lock by some another transaction, one of the two possibilities may occur -
- If TS(Ti) < TS(Tj), then Ti forces Tj to be rolled back - that is Ti wounds Tj. Tj is restarted later with a random delay but with the same timestamp.
- If TS(Ti) > TS(Tj), then Ti is forced to wait until the resource is available.
This scheme, allows the younger transaction to wait; but when an older transaction requests an item held by a younger one, the older transaction forces the younger one to abort and release the item.
In both the cases, the transaction that enters the system at a later stage is aborted.