Explain Concurrency Control with Time Stamping and Optimistic Methods.?

https://www.computersprofessor.com/2016/07/explain-concurrency-control-with-time.html
Time Stamping
:
The
order in which the transaction enter in to the data base.
|
The time stamp approach
to scheduling concurrent transaction & assigns a unique time – stamp to
each transaction.
|
The time stamp value
produces on explicit order in which transaction are submitted to the DBMS.
|
Time stamp have
2–properties.
|
Uniqueness ensures that
no equal time stamp values can exist.
|
Monotonicity ensures that
time stamp values always increase.
|
The dis advantages of
time stamping approach is that each value stored in this data base requires
two additional time stamp fields.
|
one for the last time the
field was read & one for the last update .
|
Wait
/die :
If
the transaction requesting the lock is the order of the two transactions , it
will wait until the other transaction is completed & the locks are
released.
|
If the transaction
requesting the lock is the younger of the two transactions , it will die
& rescheduled.
|
If short the order transaction
waits for the younger to complete & release the locks.
|
Wound /
wait :
If the transaction requesting the lock is
the order of 2- transactions . It will preempt (wound /stop) the younger
transaction.
|
If the transaction
requesting lock is younger of two it will wait until other transaction is
completed & locks released.
|
In short in wound/wait
schema. The order transaction rolls back the younger transactions &
reschedules it.
|
|
Concurrency Control with Optimistic Methods
|
|
An optimistic approach each transaction
moves through two or three phases.
Retrieved
as read, validation & write.
|
During
the read phase :
In
this the transaction reads the data base, executes the needed computations
& makes the updates to a private copy of the data base values.
All update operations of
the transaction are recorded in a temporary update file, which is not
accessed by the remaining transactions.
|
During
the validation phase :
The transaction is
validated to ensure that the changes made will not affect the integrity &
consistency of the data base.
If the validation test is
‘’+ve’ the transaction goes to the write phase.
If the validation test is
‘–ve’ the transaction restarted & changes are discarded.
|
During
the write phase :
The
changes are permanently applied to the data base.
|