Difference between Conservative and Strict 2PL

Prerequisites – Two Phase Locking Protocol and Types of Two Phase Locking Protocols

1. Conservative 2-PL :

  • It is also known as Static 2-PL.
  • This protocol requires the transaction to lock all the items it access before the transaction begins execution by pre-declaring its read-set and write-set.
  • If any of the pre-declared items needed cannot be locked, the transaction does not lock any of the items, instead, it waits until all the items are available for locking.

2. Strict 2-PL :

  • The most popular variation of 2-PL is Strict 2-PL.
  • It is a lighter version of Rigorous 2-PL.
  • This requires that in addition to the lock being 2-Phase all Exclusive(X) Locks held by the transaction be released until after the Transaction Commits.
  • Transactions are allowed to release Shared locks before it Commits.



Difference between Conservative and Strict 2-PL :

S.No. Conservative 2-PL Strict 2-PL
1. In Conservative 2-PL, A transaction has to acquire locks on all the data items it requires before the transaction begins it execution. In Strict 2-PL, A transaction can acquire locks on data items whenever it requires (only in growing phase) during its execution.
2. It does not have growing phase. It has growing phase.
3. It has shrinking phase. It has partial shrinking phase.
4. It ensures that the schedule generated would be Serializable and Deadlock-Free. It ensures that the schedule generated would be Serializable, Recoverable and Cascadeless.
5. It does not ensures Recoverable and Cascadeless schedule. It does not ensures Deadlock-Free schedule.
6. It does not ensure Strict Schedule. It ensures that the schedule generated would be Strict.
7. It is less popular as compared to Strict 2-PL. It is the most popular variation of 2-PL.
8. It is not used in practise. It is the most popular variation of 2-PL.
9. In Conservative 2-PL, a transaction can read a value of uncommitted transaction. In Strict 2-PL, a transaction only reads value of committed transaction.

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


1


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.