You are on page 1of 4

ExecutionoftransactionTi isdoneinthreephases. 1.Readandexecutionphase:TransactionTi writesonlyto temporarylocalvariables 2.Validationphase:TransactionTi performsa``validationtest'' todetermineiflocalvariablescanbewrittenwithoutviolating serializability. 3.Writephase:IfTi isvalidated,theupdatesareappliedtothe database;otherwise,Ti isrolledback.

Thethreephasesofconcurrentlyexecutingtransactionscanbe interleaved,buteachtransactionmustgothroughthethree phasesinthatorder.


Assumeforsimplicitythatthevalidationandwritephaseoccur together,atomicallyandserially
i.e.,onlyonetransactionexecutesvalidation/writeatatime.

ValidationBasedProtocol

Alsocalledasoptimisticconcurrencycontrol sincetransaction executesfullyinthehopethatallwillgowellduringvalidation

ValidationBasedProtocol(Cont.)
EachtransactionTi has3timestamps:
Start(Ti):thetimewhenTi starteditsexecution Validation(Ti):thetimewhenTi entereditsvalidationphase Finish(Ti):thetimewhenTi finisheditswritephase

Serializabilityorderisdeterminedbytimestampgiven atvalidationtime,toincreaseconcurrency.
ThusTS(Ti)isgiventhevalueofValidation(Ti).

Thisprotocolisusefulandgivesgreaterdegreeof concurrencyifprobabilityofconflictsislow.
becausetheserializabilityorderisnotpredecided,and relativelyfewtransactionswillhavetoberolledback.

IfforallTi withTS(Ti)<TS(Tj)eitheroneofthe followingconditionholds:

ValidationTestforTransactionTj
finish(Ti)<start(Tj) start(Tj)<finish(Ti)<validation(Tj)andthesetofdata itemswrittenbyTi doesnotintersectwiththesetofdata itemsreadbyTj.

thenvalidationsucceedsandTj canbecommitted. Otherwise,validationfailsandTj isaborted. Justification:Eitherthefirstconditionissatisfied,and thereisnooverlappedexecution,orthesecond conditionissatisfiedand


thewritesofTj donotaffectreadsofTi sincetheyoccur afterTi hasfinisheditsreads. thewritesofTi donotaffectreadsofTj sinceTj doesnot readanyitemwrittenbyTi.

ScheduleProducedbyValidation
Exampleofscheduleproducedusing validation