Concurrency Control Techniques
Concurrency Control Techniques
write_lock(X):
T1 & T2 are transactions that do not obey two phase locking because the write_lock(X)
operation follows the unlock(Y) operation in T1, and the write_lock(Y) operation follows
the unlock(X) operaiton in T2.
T1’ T2‘
read_lock (Y); read_lock (X);
read_item (Y); read_item (X); If we enforce two phase locking ,
write_lock (X); write_lock(Y) the transactions can be written
as T1’ & T2’
unlock (Y); unlock (X);
read_item (X); read_item (Y);
X:=X+Y; Y:=X+Y;
write_item (X); write_item (Y);
unlock (X); unlock (Y);
1. Require that each transaction locks all its data items before it
begins execution (pre-declaration).
This way of locking prevents deadlock since a transaction never
waits for a data item. The conservative two-phase locking uses
this approach.
2. Impose partial ordering of all data items and require that a
transaction can lock data items only in the order specified by the
partial order