Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Download
Standard view
Full view
of .
Look up keyword
Like this
4Activity
0 of .
Results for:
No results containing your search query
P. 1
DBMS4

DBMS4

Ratings: (0)|Views: 75|Likes:
Published by Punit Kaushal
KER LO DUNIYA MUTHI MAI.....
KER LO DUNIYA MUTHI MAI.....

More info:

Published by: Punit Kaushal on Nov 18, 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

06/03/2012

pdf

text

original

 
HomeWork 1Homework Title/ No:4 Course Code : CSE 301
Course Instructor : Miss Amandeep kaurD.O.A: D.O.S : 18 nov, 2010Student’s Roll No: 46 Section No. : D2801Declaration:I declare that this assignment is my individual work. I have notcopied from any other student’s work or from any other sourceexcept where due acknowledgment is made explicitly in the text, norhas any part been written for me by another person.Student’s Signature : ASHWANI KAUSHALEvaluator’s comments: _______________________________________________ 
 
Marks obtained : ___________ out of ______________________ 
 
Question 1: What variations are possible on two-phase locking protocol?
Ans:Variations are possible on two-phase locking protocol arefollowing:
Conservative 2PL
It is possible to construct a 2PL scheduler that never abortstransactions. This
 
technique is known as Conservative 2PL or Static 2X. As we haveseen, 2PL
 
causes abortions because of deadlocks. Conservative 2PL avoids deadlocks by
 
requiring each transaction to obtain all of its locks before any of its operationsaresubmitted to the DM. This is done by having each transaction predeclare its readsetand writeset. Specifically, each transaction T, first tells the scheduler all the data itemsit will want to Read or Write, for example as part of its Start operation. The scheduler tries to set all of the locks needed by T,. It can do this providing that none of theselocks conflicts with a lock held by any other transaction.If the scheduler succeeds in setting all of T,‘s locks, then it submits Ti’s operations tothe DM as soon as it receives them. After the DM acknowledges the processing of T,‘s last database operation, the scheduler may release all of l-j’s locks.
If, on the other hand, an)’ of the locks requested in T,‘s Startconflicts with locks presently held by other transactions, then thescheduler does not grant any of T,‘s locks. Instead, it inserts T,along with its lock requests into a waiting queue. Every time thescheduler releases the locks of a completed transaction, it examinesthe waiting queue to see if it can grant all of the lock requests of any waiting transactions. If so, it then sets all of the locks for eachsuch transaction and continues processing as just described. In Conservative 2PL, if a transaction T; is waiting for a lock held by Tj, then T; is holding no locks. Therefore, no other transaction Thcan be waiting for T,, so there can be no WFG edges of the form Tk -+ T,. Since there can be no such edges, T, cannot be in a WFG cycle,and hence cannot become part of a deadlock. Since deadlock is theonly reason that a 2PL scheduler ever rejects an operation andthereby causes the corresponding transaction to abort,Conservative 2PL never aborts a transaction. (Of course, atransaction may abort for other reasons.) This is a classic case of aconservative scheduler. By delaying operations sooner than it hasto, namely, when the transaction begins executing, the scheduleravoids abortions that might otherwise be needed for concurrencycontro1 reasons.
Strict 2PL
Almost all implementations of 2PL use a variant called Strict 2PL. This differs from the Basic 2PL scheduler described in Section 3.2 inthat it requires the scheduler to release all of a transaction’s lockstogether, when the transaction terminates. More specifically, Tlslocks are released after the DM acknowledges the processing of cior aj, depending on whether T; commits or aborts (respectively).
 
 There are two reasons for adopting this policy. First, consider whena 2PL scheduler can release some o&[x]. To do so the schedulermust know th;it: (1) T, has set all of the locks it will ever need, and(2) T; will not subsequently issue operations that refer to X. Onepoint in time at which the scheduler can be sure of (1) and (2) iswhen T, terminates, that is, when the scheduler receives the ci or aioperation. In fact, in the absence of any information from the TMaside from the operations submitted, this is the earliest time atwhich the scheduler can be assured that (1) and (2) hold.A second reason for the scheduler to keep a transaction’s locks untilit ends, and specifically until after the DM processes thetransaction’s Commit or Abort, is to guarantee a strict execution. Tosee this, let history H represent an execution produced by a Strict2PL scheduler and suppose wi[x] < oj[x]. By rule (1) of 2PL(Proposition 3.1) we must have1. w&[x] < WJX] < wtii[x], and2, Olj[X] < Oj[X] < OZfj[X].Because wli[~] and olj[~] conflict (whether o is r or w, we must haveeither wtti[x] < oI,[x] or oUj[x] < wlJx] (by Proposition 3.2). Thelatter, together with (1) and (2), would contradict that wi[x] < ol[x]and, therefore, 3. Wzfj[X] < olj[x].
Question 2: “Thomas write rule modifies the time-stamp orderingprotocol”. Do you agree? Justify your answer.
Ans: the
Thomas Write rule
is a rule in timestamp-based concurrency control. It states that, if a more recent transaction has already written the value of an object,then a less recent transaction does not need to have written its change.For example:Assuming that the timestamp of T1 is less than that of T2, T1's write is discarded
Thomas’ Write Rule modified the timestsmp-orderingprotocol:

Activity (4)

You've already reviewed this. Edit your review.
1 hundred reads
abi_slash liked this
karuna1240 liked this
Alok Kumar liked this

You're Reading a Free Preview

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