929 views

Assume transaction $A$ holds a shared lock $R.$ If transaction $B$ also requests for a shared lock on $R.$ It will

2. immediately be granted
3. immediately be rejected
4. be granted as soon as it is released by $A$

Shared locks exist when two transactions are granted read access. One transaction gets the shared lock on data and when the second transaction requests the same data it is also given a shared lock. Both transactions are in a read-only mode,

Transaction hold shared lock on data item A .So any number of transaction can read that the data from the requesting item using shared locking .So transaction B request will immediately granted.

So option B is correct.

 LOCK SHARED EXCLUSIVE SHARED YES NO EXCLUSIVE NO NO

why noT      D

can you give proper explanation
D is not right because shared locks can be accessed by multiple transactions.

The reason is because shared locks are used when read operation needs to be performed. While exclusive locks are used when both read and write operation need to be performed.

If multiple transaction simultaneously read same data then there won’t be any inconsistency, But when write operation is simultaneous then you have problems like dirty read or/and blind write.

So the above justification concludes that shared locks can be simultaneously accessed but exclusive locks aren’t.