![]() Wait for graph: It is used in the deadlock detection method, creating a node for each transaction, creating an edge Ti to Tj, if Ti is waiting to lock an item locked by Tj. Both the transaction cannot proceed further at least any one releases the lock voluntarily. In the above situation T1 waits for B and T2 waits for A. Lock-X(A) : Cannot execute Lock-X(A) since A is locked by T1. Lock-X(B) : Cannot execute Lock-X(B) since B is locked by T2. The 2PL protocol guarantees serializability, but cannot guarantee that deadlock will not happen. Rigorous two phase locking protocolĪ transaction cannot release any lock either shared or exclusive until it commits. So if one has to rollback then the other has to rollback. This protocol creates a cascade less schedule.Ĭascading schedule: In this schedule one transaction is dependent on another transaction. ![]() Two phase locking is of two types − Strict two phase locking protocolĪ transaction can release a shared lock after the lock point, but it cannot release any exclusive lock until the transaction commits. This point is called LOCK POINT.Īfter the lock point has been reached, the transaction enters a shrinking phase. In the growing phase transaction reaches a point where all the locks it may need has been acquired. The 2PL locking protocol is represented diagrammatically as follows − Shrinking phase − No locks are issued in this phase, all the changes to data-items are noted (stored) and then locks are released. No locks are released, after all changes to data-items are committed and then the second phase (shrinking phase) starts. Growing Phase − All the locks are issued in this phase. 2PL locking protocolĮvery transaction will lock and unlock the data item in two different phases. Locking and unlocking of the database should be done in such a way that there is no inconsistency, deadlock and no starvation.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |