f- Axsignment No.- 4
Q1. What clo you mean by cleccllock ? lahat ane the veusious
condition uncer which olecicllock occwrs? Discuss the weit-clie
ancl wouncl- wait in oletail,
An» Tn a clatabase management system (DBI18), 0 cleackloch
OCW When two Oo» Mose transactions Que waiting for each
other to wielecse vierowrees wuch ar Lochs on cutabase
objects, that they neecl-+to complete theis operections- Ae a
viesult , none
the tescinscctions can prsoceec, Leacling to a
situation where they ae stuck or “Clecollockeol”
Assignect,
weut
Voxious condition undlex which cleadlock ocewts t-
GW» Mutual Exclusion— this condition weqaiies thet atleast ene
vtesounce te helel in non- shareable mocle which can
only one poocers cen use the wesounce at any giver time.
(il) Hotel ancl Wait- This conclition Abecifies thet a provers
must be holeling at Least one wesowice white waiting
for othex process to velease wesource that ane currently
helcl by other proce.
ii) No Rieembtion- T+ is act
faking of Hesounce from a
proces before it has finishecl ite fork.y
4 7
(ivy Cimeuleur Weit- This cenclition implies cisccla procerser m,
exist, which each process waiting fos & vICOUoe helol 6
the next poocers in the chain.
e Wait-Dre - T+ is a non- preemptive technique fos cleacllook
psevention. When tscuscaction Th vreyuest o& clatte item
curently helel 6y Te, The allowecl to wait only if i+ has o
Fim ensteump smaller then tet of Te.
Th this, if a +e cnscction vieguests +o Look C SesoUNcEe
Celetten item), which is alsecucly helol with a conflicting
dock $y another tsunsection, then one of the two powsibitie
moy OCCU.
1. Timestamp (Th) < Timestoumb (Tr)
2. Timestump (Th) > Timesteump CT)
Wound- wait T+ is a preemptive technique for cv cleucllock
peevertion. THs a counterpourt to te wait-clie wcheme.
when tremaction Th vreyuests ov cleter item cworently
nelel &y Tr, Th is allowecl +o weit only if it has cu time
vtamp Loiger than that of Tr, othenwise Tr is Rillect.
Th this, if a tsanscuction weqruests to Lock @ resowiee
(cboder iter), which is alweacly helol with conflicting Lock
ty wome cnothen transection.
9.3. Whot clo you mean By vscheclule in the context og
conewuent execution of transactions in RDBMS 2 Whee
in wegolizable wcheclule ? Discuss the vwdous types
of werializability with a wuitalle example. ,New A wthediule Lssaiol to be concwwurent in coe that the
instsuctows of the trermactions get executecl bseemptiel
Tf two teantections ave viunnin
O&E May execute one transaction fox c little while then
petfoom co. context uwitth, ex ecute the beconel, tscunscution
foo wome time cuncl then switch buck to the fixet one.
Tha, the number of parsitle wchecliles POT CL wet of h
touumietions is much lagen Yreur n!.
ConceucHent Uscheclulers might get affectecl with conflicting
Opexections cuncl hence cloes not Give gurantee foo cloota
consistency,
y Concwin ently the elodeb-
Serializable Scheclules :-
. Al schedule ts wericlizecl if it is
eqyrivelent +o cL beUCLL eoheclute . A conctument schedule
must ensue itis the vscume cs if execectect werally
mecuw one after another . I+ viefous +0 the weguence of
actons wuch as secel, write, abost, commit ane pexfos-
mecl in & wertial manner
Vaxiows types of Sedclizability ce
> Conflict Serializebility
> View Seuclizability
4. Conflict Serializaletlity -
Conflict weriedizedxility efers to a subset of rerieliza-
bilthy thot focuses on Mainting the Consistency of &
elotablose while enswung thee iclerticet, elector items cure
executecl in an owcley.v
Example: Consicber the thee tounsactions it: Tr, I, Ts ona
-bchechue S. Check whether Sis a conflict Od aliznly
0% not:
Conflict Pairs,
Rlad— Wea) IT Ts
Rla)—Wla) :T-> th
R(6)— Wb) 2 x
R(6)- Wb) i RT
Wlad~Wlad + TT,
Wlad- Wad 2 Nh
Wlad- Wla) 1 ROR
Rla) - war : yx
Now,
Psececkence graph
<%
Tt is conflict serializable as graph clo not have cycle.&. View Sedalizabitity ~
View Sexializability is the kinclof operctions in @ serializalle
in which each trears action shocilel bvovicle ome ules,
Anek these. oceteomes are the otetput- of Arvoperly seqrentiall
ex ceceting the elata item.
Thee cixcumstances cure listecl to check serializebclity
+ Thitiol Reaol
* Intenmecliate Reacl
+ Finol ute
Exaunple— Consicler huo transection T&T
1 & Tz in schedule §
anck check whether $ ts view serializable os not
owt, we check § is conflict serializable ox not. The following
conflict parse are:
Rla)-Wla) ? TG
wa) — Wa) :
RIG) — WE)! Tom
Wb) — WIEI? T>Tr
Prececlence Grsaph,
T> ThTherefore, given wohecbule ‘5! conflict wouializabte. Now, X
check fow view werializable
View Eqeuivalent Schecule, (5)
Dependency gcuph,
R 5)
Ra)
Wed
Rit)
w(6)
“This a view werializakle with schedule 's’
3. Compoue anc constsast the features of dog basedt necovery
Mmechaninm versus check pointing tavect Hnecovery. Suggest
applications where You will psefer log Lasecl recovery
acheme ovex check pointing. dive an example of check
pointing Susecl, wecovery -echeme. Discuss the vecoveralie
uchedule also,
Log-Barecl Recovery
oT uelies on maintaining a
toansaction dog thet Wecosels
all changes macle to the
doto.tore.
iF
Checkpoint- Basecl Recovery
ane.
consistent snapshots of the
olectabose state.
Qranuality, coptwong the
entive olatulcse. tate oo
Point in time.+ Dwuing recovery, the system
weplayes thu upg fom the dest
consistent vetecte, applying the
dogyeck changes +o seconstsuct
the clectaibebe +0 c& consistem
tate
* The ovexheccl, of slogging
every change cen bo welntiv
ely high in teyms of clink
space ancl write o perations.
* Durning viecoveny the system
can viestose the cote Beue,
+o the Latest checkpoint ane
then apply the -ounsactions
foo the Jog wince thet
checkpoint.
* Coeating checkpoints incur
atim one-time cash and
the dog may be smaller
Geccuse, it only contains
change, wince the last check
boink.
Log -Garecl “ecoveny vochemer ane portiosly wells uitecl for
applications where the gsenulouty of changes neecl» +0 be trucker
at a cetailecl Uevel, ancl the emphasis ts on minimizing doco
Leys in the event of afailune. Here are wome scenwuias where
Wwe might prefer a log- basect Wecovery wbcheme:
1. Online THansaction Rxocessing Systems
a. Financial Systems.
3. Mision ~ Wwitical Systems .
4. Real-time Systems
5. Concurrency (onbuol
6. Complex Transaction Waukiours.
Example of Check pointing Gareck neeoveny scheme Bete cles
an online whopping applicoction ce an examble Of Ce Check poirrting
tosecl wecoverty weheme.
Example Scenotio :
= At 42:00 PM, a checkboint ix cxectecl, caphwuing te stete
of the clotrrtese.
+ At 1330 PM, aw customer places an osclen, cuncl the system
Hewes this transaution inthe +ewwaction Loy.{-
AY 2:00 PH, wystem failure occwus
Recovery Steps:
41+ Telentify the Loust consistent checkpoint et 12:00 PM.
a. Restowe the cleetrbeuse to thestete captunectin tre 12:00 PH
checkpoint.
3. Reapkly tecurscictions foom the ung, inclucling the customer
oscler plececl ect 1:30 PM.
By using checkpointing the system cen efficiently viecover
+o a known consistentstete, siecducing the amount of Log
uieklay neeclel compcuiecl to c full Log-basecl vecovery.
Recovertelcle Scheclule 3 -
A scenanio with multiple tecanscections
in te voystem :
1. Transcection TL:
+ A+ 42:00 PH, TA wteurks candl upolectes He gucntity of a
product in the cleteefruse.
+ At 19:45PM, Td completes, ancl the changes are Loggect.
2. Transaction T2:
oAt 12:30 PM,T2 wtourts cuncl pooceres a customer ovelen,
upelocing ovelex tects
+ AFL2:45 PH, T2 combletes,ancl the changes ane Logyect.
3. Transcuction T3:
+ At 4:00 PM, TS wtourts canel acs a new product to the
inverttosy-
+ At 1:15 PM, 13 Completes, ancl the changes wre Log gecl.
4. Checkpoint at 1:00 PN:
«A+ 1:00 PM, & checkpoint is cxectect
of the cleutabase ese niog theta£30 RAST Ws ane brocessed Q veto wegueot
4:30 7 e ty anol Proce OX de teYy Ff
updating trven » CNed ovelere Sfeettes
oe DM. Ty ates cuncl the cheung es cre fe
> onroid ven Gelocy. Determine w bb
ye nonviecoveralle Also chrase &
&
RACP)
R3(@)
Gs(Q
ws (R)
Ww, (Q)
Gy
Gascadeless: No uncomimittect seacl ts allocweel.
Reaoverable Scheclule: Txcuaction does aencommittecl rec cl.
epercction shocked, not commit before violléack of tears action
which upeatect date item
Non-vtecaveralle &chedule- Opbasite of viecoverable scheclule.Precedence bicaph-
Tatu echedsule-
Schedules,
thete—ane-no-sy
Ry (PI— WCRI + ¥
Rr UR — W(R 2X
* The wehedule is secoveralle Gecoune Te meocls 22 tefsr
T cormrmits ond Ts weads @ atten Ty commits.
The wsthedule ix not c
Gnd. Tz weocs P before T commits.
oecideder. Gecoure T
writes Ph
Thenefooe, th given wcheclule it Heccveralle het
not toscadeles and non-wcecovenable.
T, --+ Th--4Ts
Ta--? Tro - Ts
T3- 1-7? Ts
Ts -->T2-->T = Ccommit]
1 48 7% Gera)
v
Coommit]f
Q5. Check whether Hu given scheclule $ i& view betializalte ov
not -
Th
RCA)
A= Adito none.
N- AILO
tC)
wend
RCBD
= B420
° RCBI
B= BxRI4
WCB)
WCB)
Sol” — Eqnivatence S,
Foust ,we check given schedule is conflict sedatinzalle
os not. the following pairs ane—
REA) — WORD tT Tz
RCA) — WEA): T2 >
win) — WIA): TT
ROB) — WCB) + T > T2
RB) — WCB) + Ta+T
13 B) — SOB ea aia.Raececlence Graph
Case)
In given weheclule $ cycle exist then it ts not ce conflict
wetcdizable, So, it may ov may not be view werializalle.
Step1> Buincl Wwute- There is no élincl write exist then given
ctheclule is not a view serializable.