Schedul Esi NDBMS: Typesofschedul Es I NDBMS, Schedul Esmaybecl Assi Fi Edas

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Schedul

esi
nDBMS
TypesofSchedul
es
I
nDBMS, schedul
esmaybecl
assi
fi
edas:
 

*
Seri
alSchedules:
I
nseri
alschedules,
 Al
lthet
ransact
ionsexecut
eser
ial
l
yoneaf
tert
heot
her
.
Whenonet r
ansact
ionexecut
es,
noot
hert
ransact
ioni
sal
l
owed
toexecut
e.
 
Charact
eri
sti
cs-
Ser
ialschedul
esar
eal
way
s-
 Consi st
ent
 Recov erable
 C ascadeless
 Strict
Exampl e:

I
nthi
sschedul
e,
 Therearetwotransacti
onsT1andT2 executi
ngser
ial
lyone
aftert
heother
.
 Transact
ionT1executesfir
st.
 AfterT1completesit
sexecuti
on,
transact
ionT2executes.
So,t
hisschedul
eisanexampl
eofa 
Ser
ial
Schedul
e.
Exampl
e:

I
nthi
sschedul
e,
 Therear etwotransacti
onsT1andT2execut i
ngseri
all
yone
aftertheother
.
 TransactionT2executesfir
st.
 AfterT2compl etesit
sexecuti
on,
transacti
onT1executes.
 So, t
hisscheduleisanexampleofa Seri
alSchedul
e. 

Non-
Serial
Schedules:
I
nnon-seri
alschedul
es,
 Mul t
ipl
et r
ansact
ionsexecuteconcurr
entl
y.
 Operationsofall
thetransact
ionsareint
erleav
edormi
xedwi
th
eachot her.
Characteri
sti
cs:
Non-serial
schedul
esare NOT always-
 Consi st
ent
 Recov erable
 C ascadeless
 Strict
Exampl e:

I
nthi
sschedul
e,
 Ther
earetwot r
ansact
ionsT1andT2executi
ngconcurrent
ly.
 Theoperat
ionsofT1andT2areinterl
eav
ed.
 So,t
hisschedul
eisanexampleofa Non-
Ser
ialSchedul
e. 
Example:
I
nthi
sschedul
e,
 Ther
earetwot r
ansact
ionsT1andT2executi
ngconcurrent
ly.
 Theoperat
ionsofT1andT2areinterl
eav
ed.
 So,t
hisschedul
eisanexampleofa Non-
Ser
ialSchedul
e.
 
Fi
ndingNumberofSchedul
es-
Considert
herear
ennumberoftr
ansact
ionsT1,T2,T3….,Tn
wit
hN1, N2,N3….,Nnnumberofoper
ati
onsrespecti
vel
y.
1.Total
NumberofSchedules:
Total
numberofpossi
bleschedul
es(
ser
ial
+non-
ser
ial
)isgi
ven
by:
2.Total
NumberofSeri
alSchedul
es-
Total
numberofser
ial
schedules
=Numberofdi
ff
erentway
sofar
rangi
ngnt
ransact
ions
=n!
3.Total
NumberofNon-
Seri
alSchedules-
Total
numberofnon-
ser
ial
schedules
=Tot
alnumberofschedul
es–Tot
alnumberofser
ial
schedul
es 
Problem:
Considertherear
ethr
eet
ransact
ionswi
th2,
3,4oper
ati
ons
respecti
vely
,fi
nd-
1.Howmanyt
otal
numberofschedulesarepossibl
e?
2.Howmanyt
otal
numberofseri
alschedulesar
epossibl
e?
3.Howmanyt
otal
numberofnon-ser
ialschedul
esarepossi
ble?

Sol
uti
on-
Tot
alNumberofSchedul
es-
Usi
ngtheabov
eformula,
wehav e:

Tot
alNumberofSeri
alSchedules-
Tot
alnumberofser
ialschedul
es
=Numberofdi
ff
erentway
sofar
rangi
ng3t
ransact
ions
=3!
=6
Tot
alNumberofNon-
Ser
ial
Schedul
es-
Tot
alnumberofnon-
ser
ial
schedul
es
=Tot
alnumberofschedul
es–Tot
alnumberofser
ial
schedul
es
=1260–6
=1254

Recov
erabi
l
ityofSchedul
e
I
rr
ecover
ableSchedul
es
I
finaschedul
e,
 At ransact
ionperfor
msadi rt
yreadoperat
ionfr
om an
uncommi t
tedtr
ansaction
 Andcommi t
sbeforethetr
ansacti
onfr
om whichithasreadt
he
value
thensuchaschedul eisknownasan Ir
recover
ableSchedul
e.
Example
Consi
derthef
oll
owi
ngschedul
e-
Her
e,
 T2performsadi rt
yr eadoper
ation.
 T2commi tsbeforeT1.
 T1fai
lslaterandrollbacks.
 ThevaluethatT2r eadnowst andstobeincor
rect
.
 T2cannotr ecov
ersinceithasal r
eadycommitt
ed.

Recov
erabl
eSchedul
es-
I
finaschedul
e,
 Atransact
ionperf
ormsadirt
yreadoperat
ionfr
om an
uncommi t
tedtr
ansact
ion
 Anditscommitoperat
ionisdel
ayedti
ll
theuncommitted
tr
ansacti
oneit
hercommi t
sorrol
lbacks
t
hensuchascheduleisknownasa Recover
ableSchedul
e.
Her
e,
 Thecommi toperati
onoft hetr
ansact
ionthatper
formst
hedi
rt
y
readisdelayed.
 Thisensuresthatitsti
llhasachancetorecoveri
fthe
uncommi ttedtransact
ionfail
slat
er.
Example-
Considert
hef ol
lowingschedule- 

Her
e,
 T2perfor
msadi r
tyreadoper
ati
on.
 Thecommi toper
ati
onofT2isdelay
edt
il
lT1commi
tsorr
oll
backs.
 T1commi tsl
ater
.
 T2isnowall
owedtocommit
.
 I
ncase,T1wouldhav
efai
l
ed,T2hasachancet
orecov
erby
rol
l
ingback.

You might also like