0% found this document useful (0 votes)
81 views2 pages

Two-Phase Locking Protocols Explained

T9 T12 T13 T14 T15 T16 T19 Under strict two-phase locking, the transactions would end in the order of T14, T15, T16, T13, T12, T19, T9. Under rigorous two-phase locking, all shared and exclusive locks must be held until commit/abort, so the transactions cannot complete and will deadlock.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
81 views2 pages

Two-Phase Locking Protocols Explained

T9 T12 T13 T14 T15 T16 T19 Under strict two-phase locking, the transactions would end in the order of T14, T15, T16, T13, T12, T19, T9. Under rigorous two-phase locking, all shared and exclusive locks must be held until commit/abort, so the transactions cannot complete and will deadlock.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Name: Hamida Batool (38615) Department: CS(A)

Advanced Database Management Systems – Assignment 01


Question 01:
In this assignment you are going to execute the following transactions using strict
and rigorous two-phase locking protocols. Moreover, you need to list the order in
which the transactions are going to end. Finally, briefly compare your answers
(transactions end order) of strict and rigorous two-phase locking protocols.

T9 T12 T13 T14 T15 T16 T19


Read(X)
Read(Y) Read(Z)
Read(U)
Read(V)
Write(U)
Read(V)
Write(V)
Read(W)
Write(W)
Write(U)
Read(X)
Write(X)
Write(W)
Read(X)
Write(X)
Write(Y)
Read(X)
Write(X)
Write(Z)

Strict two-phase locking: It should satisfy the basic two-phase lock and
exclusive locks should hold until commit/abort.
Name: Hamida Batool (38615) Department: CS(A)

T9 T12 T13 T14 T15 T16 T19


Lock-X(U) Lock-X(X) Lock-S(Z)
Read(U) Read(X) Read(Z)
Lock-S(V) Lock-X(Y)
Read(V) Read(Y)
Write(U)
Lock-X(X)
Read(X) Lock-X(W)
Write(X) Read(W)
Commit Write(W) Lock-X(U)
UL(U) Write(U) Lock-X(X)
UL(V) Lock-X(V) Read(X)
UL(X) Read(V) Write(X)
Write(V) Lock-S(X) Commit Write(W)
Commit Read(X) Lock-X(Z) UL(Z)
UL(V) Write(X) Commit Write(Z) UL(X)
Write(Y) UL(W) Commit
Commit UL(X) UL(U)
UL(X) UL(Z)
UL(Y)

Rigorous two-phase locking: It should satisfy the basic two-phase lock and all
shared, exclusive locks should hold until commit/abort.

You might also like