Explain two-phase locking protocol.
In a multiprogramming environment where multiple transactions can be executed simultaneously, it is highly important to control the concurrency of transactions. We have concurrency control protocols to ensure atomicity, isolation, and serializability of concurrent transactions.
Two Phase Locking Protocol has two phases.
Initially the transaction is in growing phase, that is the transaction acquires locks as needed. Once the transaction releases lock, it enters the shrinking phase and no more lock request may be issued. Upgrading of lock is not possible in shrinking phase, but it is possible in growing phase. The two phase locking protocol ensures serializability.
Conservative 2PL (Two Phase Locking)
In conservative 2PL there is no growing Phase, Only having shrinking Phase. It gets all the locks before the execution starts.
Strict 2PL
Not releasing the write lock (Exclusive Lock) until commit.
What do you mean by ‘Ternary Relationship’? Define the concept of aggregation with suitable example.
What is Weak entity set? Explain with suitable example.
Short Notes :Lines of Code (LOC)