reset password
Author Message
hanishppatel
Posts: 10
Posted 21:10 Nov 22, 2010 |
I have few questions regarding the Homework
 
1) Ex 14.25,
 
To Implement the 2PL, if Transaction 1 requires read and write operation on block (A) then, does Transaction need to have slock and xlock explicitly on block (A) or only xlock suffice?
As per even simpleDB implementation, it will always first acquire slock in order to have xlock.
 
2) 14.25 (b), do we need to have schedule to display both transaction history with lock ad unlock actions? if yes, can it be serial schedule only?
 
3) Ex 14.52,
The test file should contain the commit at the end of Transaction or should we have commit after each operation of the transaction to release the resources after each operations.
cysun
Posts: 2935
Posted 21:53 Nov 22, 2010 |

1. The transaction will acquire a slock first for the read, then the slock will be "upgraded" to a xlock for the write, like:

sl1(A),r1(A),xl1(A),w1(A)

The transaction cannot acquire a xlock at the beginning because it cannot predict the future write action on A.

2. No, you just need to add lock and unlock actions to the two histories, i.e. you don't need to show a schedule.

3. I don't know what you are talking about. There's at most one commit at the end of a transaction. If you commit after every action, it's no longer a transaction.

hanishppatel
Posts: 10
Posted 19:57 Nov 23, 2010 |
1) For 14.25(b),
While displaying the history of the transaction with Lock and Unlock actions in 2PL,
if a Transaction T has following history on block B
SL1(B); R1(B); XL1(B); W1(B).
 
1) to display unlock action only UL1 is suffice or we need to provide both unlock Action USL1 AND UXL1 ?
2) If we need to provide both of the unlock action, as per yr last reply " since xlock is upgrade of slock", xlock should be released first and then slock will be released, right? please correct me if I am wrong. and hence the 2pl sequence for the above transaction will be as follows:
SL1(B); R1(B); XL1(B); W1(B);UXL1(B);USL1(B)
 
2) For 14.25(c)
Is it fine if we display a non - serial schedule with lock actions till that point where the deadlock happens, because anyways the further steps are not going to be executed by the transactions.
cysun
Posts: 2935
Posted 20:47 Nov 23, 2010 |
hanishppatel wrote:
1) For 14.25(b),
While displaying the history of the transaction with Lock and Unlock actions in 2PL,
if a Transaction T has following history on block B
SL1(B); R1(B); XL1(B); W1(B).
 
1) to display unlock action only UL1 is suffice or we need to provide both unlock Action USL1 AND UXL1 ?
2) If we need to provide both of the unlock action, as per yr last reply " since xlock is upgrade of slock", xlock should be released first and then slock will be released, right? please correct me if I am wrong. and hence the 2pl sequence for the above transaction will be as follows:
SL1(B); R1(B); XL1(B); W1(B);UXL1(B);USL1(B)
 
2) For 14.25(c)
Is it fine if we display a non - serial schedule with lock actions till that point where the deadlock happens, because anyways the further steps are not going to be executed by the transactions.

1) You just need UL1.

2) Yes.