Respuesta :
Explanation:
Pessimistic Locking:
In this locking scheme a record is locked immediately when the user is requested for the lock and it will lock the records until user finished with the execution. When the user is done with accessing the document, the locks can be removed or released either manually or using a timeout protocol and user needs either a direct connection to the database or any external transaction ID for using this lock.
Two-Phase Locking:
The implementation phase of a transaction is divided into three parts with the help of two-phase locking. In the initial part, when the transaction starts implementing, it pursues authorization for the lock requires. In the second part, the transaction obtains all the locks and finally the transaction cannot demand for the new locks as it releases all the acquired locks.
Two-Phase locking system divided into two phases:
Growing Phase
- The transaction may attain the locks.
- The transaction may not release any locks.
Shrinking Phase
- The transaction may release the locks.
- The transaction may not attain any of the locks.
Pessimistic Locking with Two-phase Locking, The chronological list of the locking, unlocking, and data manipulation activities that would occur during the complete processing of the above given transaction which is described in 6b is as follows:
Note: Refer the image attached
