Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
2Activity
0 of .
Results for:
No results containing your search query
P. 1
sol ass 4

sol ass 4

Ratings: (0)|Views: 20 |Likes:
Published by Yogesh Gandhi

More info:

Published by: Yogesh Gandhi on Dec 04, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

12/25/2012

pdf

text

original

 
dfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmrtyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasd
ASSIGNMENT NO 4
Submitted to: Chavi MamSubmitted By:- Yogesh Gandhi10808452RC2801B48
 
ANS 1
Two Phase Locking Protocol (2PL):
The Two Phase Locking Protocol ensures Serializability. This protocol requires thateach transaction issue lock and unlock requests in two phases:
1. Growing Phase:
A transaction may obtain locks but may not release any lock.
2. Shrinking Phase:
A transaction may release locks but may not obtain any new locks.A transaction is said to follow Two Phase Locking Protocol if all locking operations precede the first unlock operation in a transaction. In other words release of locks on all dataitems required by the transaction have been acquired both the phases discussed earlier aremonotonic. The number of locks are decreasing in the 2
nd
phase. Once a transaction starts torequest any further locks.Transaction T1 shown in Figure 1 below transfers $50 from account B to account Aand transaction T2 in next Figure 2 displays the total amount of money in account A and B.Figure 1:T1 :Lock_X (B);Read (B);B := B – 50;Write (B);Unlock (B);Lock_X (A);Read (A);A := A + 50;Write (A);Unlock (A);
 
Figure 2:T2:Lock_S (A);Read (A);Unlock (A);Lock_S (B);Read (B);Unlock (B);Display (A + B);Both the above transaction T1 and T2 do not follow Two Phase Locking Protocol.However transactions T3 and T4 (shown below) are in two phase.T3:Lock_X (B);Read (B);B := B – 50;Write (B);Lock_X (A);Read (A);A := A + 50;Write (A);Unlock (A);Unlock (B);T4:Lock_S (A);Read (A);Lock_S (B);Read (B);

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->