reset password
Author Message
HelloWorld
Posts: 88
Posted 23:09 Aug 19, 2009 |

I don't understand on Question b of 14.25:

"Add lock and unlock actions to these histories that satisfy the lock protocol"

So, we're suppose to add 2PL locking protocol using the history sequence.. Should we treat each of the transaction as its own sequence and add 2PL locking protocol to each sequence, or concatenate these transactions and then use 2PL protocol for the whole sequence?

In either case, I'm wondering if it's possible "without" moving the item in the sequence around to achieve 2PL? Consider:

W(b1); R(b2); W(b1); R(b3); W(b3); R(b4); W(b2)

from the following 2PL rule:

"In each transaction, all lock requests proceed all unlock requests"

we cannot request exclusive lock for b3, since there's still going to be shared lock request for b4

Thanks

Last edited by HelloWorld at 23:22 Aug 19, 2009.
cysun
Posts: 2935
Posted 07:16 Aug 20, 2009 |
HelloWorld wrote:

I don't understand on Question b of 14.25:

"Add lock and unlock actions to these histories that satisfy the lock protocol"

So, we're suppose to add 2PL locking protocol using the history sequence.. Should we treat each of the transaction as its own sequence and add 2PL locking protocol to each sequence, or concatenate these transactions and then use 2PL protocol for the whole sequence?

14.25(b) says to "add lock and unlock actions to these histories". The textbook calls the sequence of the actions by a transaction the transaction's history. So in (b), the lock/unlock actions are added to each transaction, not to a schedule.

In either case, I'm wondering if it's possible "without" moving the item in the sequence around to achieve 2PL? Consider:

W(b1); R(b2); W(b1); R(b3); W(b3); R(b4); W(b2)

from the following 2PL rule:

"In each transaction, all lock requests proceed all unlock requests"

we cannot request exclusive lock for b3, since there's still going to be shared lock request for b4

I don't know what you are saying. Why can't you request a xlock on b3 and then request a slock on b4?

HelloWorld
Posts: 88
Posted 16:11 Aug 20, 2009 |

I don't know what you are saying. Why can't you request a xlock on b3 and then request a slock on b4?

But if we want to request an xlock on b3, shouldn't we release the slock on b3 first, since there's a Read request before Write on B3? But we cannot release the slock because not all locks is taken in T1 right?

cysun
Posts: 2935
Posted 21:49 Aug 20, 2009 |
HelloWorld wrote:

I don't know what you are saying. Why can't you request a xlock on b3 and then request a slock on b4?

But if we want to request an xlock on b3, shouldn't we release the slock on b3 first, since there's a Read request before Write on B3? But we cannot release the slock because not all locks is taken in T1 right?

As we discussed in class, a schedule sl1(b3),r1(b3),xl1(b3),w1(b3) is OK because the shared lock is held by T1 itself, and xl1(b3) simply upgrade the shared lock to a exclusive lock (of course assuming there are no other shared locks on b3).