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

Database Management Systems Practice Problem Set: Transaction and Concurrency Control

The document discusses transaction and concurrency control in database management systems. It presents two transactions - T1 and T2 - and analyzes different concurrent executions to determine whether consistency is preserved. It also analyzes four instances of transactions T1 and T2 that use locking to determine if they satisfy various concurrency control properties like serializability and avoid issues like deadlocks. Finally, it discusses how the forest protocol, a variant of tree locking, does not ensure serializability.

Uploaded by

Mandeep Gill
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views2 pages

Database Management Systems Practice Problem Set: Transaction and Concurrency Control

The document discusses transaction and concurrency control in database management systems. It presents two transactions - T1 and T2 - and analyzes different concurrent executions to determine whether consistency is preserved. It also analyzes four instances of transactions T1 and T2 that use locking to determine if they satisfy various concurrency control properties like serializability and avoid issues like deadlocks. Finally, it discusses how the forest protocol, a variant of tree locking, does not ensure serializability.

Uploaded by

Mandeep Gill
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Database Management Systems Practice Problem Set: Transaction and Concurrency Control

1. Consider the following two transactions: T1 : read(A); read(B); if A = 0 then B := B + 1; write(B). T2 : read(B); read(A); if B = 0 then A := A + 1; write(A). Let the consistenc re!"ire#ent $e A = 0 B = 0% with A = B = 0 the initial &al"es. a. 'how that e&er serial e(ec"tion in&ol&ing these two transactions )reser&es the consistenc of the data$ase. $. 'how a conc"rrent e(ec"tion of T1 and T2 that )rod"ces a nonseriali*a$le sched"le. c. +s there a conc"rrent e(ec"tion of T1 and T2 that )rod"ces a seriali*a$le sched"le, 2. -nd all &iew.e!"i&alent serial orders for the following sched"le: r1 (/) r0 (T ) w1 (1 ) r2 (1 ) w0 (1 ) r2 (1 ) w2 (3) r4 (3) w2 (') r4 (') w4 (1 ) 0. Consider the following two transactions: T1 = w1 (3) r1 (/) w1 (/) r1 (1 ) w1 (1 ) T2 = r2 (1 ) w2 (1 ) r2 (/) w2 (/) Let "s ass"#e that o"r sched"ler )erfor#s e(cl"si&e loc5ing onl (i.e.% no shared loc5s). Consider the following instances of transactions T1 and T2 annotated with loc5% "nloc5% and (so#eti#es) co##it actions: (a) T1 = L1 (3) w1 (3) L1 (/) r1 (/) w1 (/) 61 (/) L1 (1 ) r1 (1 ) w1 (1 ) 61 (3) 61 (1 ) T2 = L2 (1 ) r2 (1 ) w2 (1 ) 62 (1 ) L2 (/) r2 (/) w2 (/) 62 (/) ($) T1 = L1 (3) w1 (3) L1 (/) r1 (/) w1 (/) L1 (1 ) r1 (1 ) w1 (1 ) C1 61 (/) 61 (3) 61 (1 ) T2 = L2 (1 ) r2 (1 ) w2 (1 ) L2 (/) r2 (/) w2 (/) C2 62 (/) 62 (1 ) (c) T1 = L1 (3) L1 (/) w1 (3) r1 (/) w1 (/) L1 (1 ) r1 (1 ) w1 (1 ) C1 61 (/) 61 (3) 61 (1 ) T2 = L2 (1 ) r2 (1 ) w2 (1 ) L2 (/) r2 (/) w2 (/) C2 62 (/) 62 (1 ) (d) T1 = L1 (1 ) L1 (3) w1 (3) L1 (/) r1 (/) w1 (/) r1 (1 ) w1 (1 ) C1 61 (/) 61 (3) 61 (1 ) T2 = L2 (1 ) r2 (1 ) w2 (1 ) L2 (/) r2 (/) w2 (/) C2 62 (/) 62 (1 ) -or each instance% indicate whether the annotated transactions satisf the following conditions: (1) 7$e two.)hase loc5ing. (2) 7$e strict two.)hase loc5ing. (0) 8ill necessaril res"lt in a con9ict seriali*a$le sched"le (if no deadloc5 occ"rs). (2) 8ill necessaril res"lt in a reco&era$le sched"le (if no deadloc5 occ"rs). (4) 8ill necessaril res"lt in a sched"le that a&oids cascading roll$ac5s (if no deadloc5 occ"rs). (:) 8ill necessaril res"lt in a strict sched"le (if no deadloc5 occ"rs). (;) 8ill necessaril res"lt in a serial sched"le (if no deadloc5 occ"rs). (<) =a res"lt in a deadloc5.

2. 'how that there are sched"les that are )ossi$le "nder the two.)hase loc5ing )rotocol% $"t are not )ossi$le "nder the ti#esta#) )rotocol% and &ice &ersa. 4. Consider a &ariant of the tree )rotocol called the forest )rotocol. The data$ase is organi*ed as a forest of rooted trees. >ach transaction Ti #"st follow the following r"les: ? The @rst loc5 in each tree #a $e on an data ite#. ? The second% and all s"$se!"ent% loc5s in a tree #a $e re!"ested onl i the )arent of the re!"ested node is c"rrentl loc5ed. ? Aata ite#s #a $e "nloc5ed at an ti#e. ? A data ite# #a not $e reloc5ed $ Ti after it has $een "nloc5ed $ Ti. 'how that the forest )rotocol does not ens"re seriali*a$ilit .

You might also like