timestamp ppt for beginners you can copy it he he

mmmfaaaamx 29 views 10 slides Sep 14, 2024
Slide 1
Slide 1 of 10
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10

About This Presentation

Timestamp protocol ppt


Slide Content

TIMESTAMP PROTOCOL Presented By: B tech, CSE 3 rd year

TIME STAMP ODERING PROTOCOL Timestamp means a unique value or time attached to a transaction . Timestamp is denoted by TS Timestamp tells us the order of transactions i.e , when they enter into the system. Suppose , transaction T1 enters into the system at time 10:00 and its Timestamp value is 100. Now lets say transaction T2 enters into the system at time 10:10 and its Timestamp value is 200. Now T1 becomes old as T2 is the new transaction in the system. The new transaction(T2) will always have a greater timestamp value then the previous one(T1). So, by comparing the TS of both transactions we can easily find out the sequence of transactions. 10:00 10:10 T1 T2 100 (old) 200(new)

Here , we talk about the three timestamps : Timestamp of the transaction : The timestamp value of a system when it enters into the system . It is denoted by TS( Ti ) where, TS= Timestamp Ti =transaction no From the table , we got TS(T1)=100 TS(T2)=200 10:00 10:10 T1 T2 100 (old) 200(new)

2. READ__TS(RTS): Last(latest) transaction number that has performed Read successfully . Suppose , we take three transactions T1, T2 and T3 whose timestamps are 10, 20 and 30. HERE, RTS(A)= 30 ( Since, RTS says latest transaction that has performed read successfully and here T3 reads at the last so RTS(A)=30) TS = 10 TS=20 TS=30 T1 T2 T3 R(A ) R(A) R(A)

2. WRITE _TS(WTS ): Last(latest) transaction number that has performed Write successfully . Suppose , we take three transactions T1, T2 and T3 whose timestamps are 10, 20 and 30. HERE, WTS(A )= 20 ( Since, WTS says latest transaction that has performed write successfully and here T2 writes at the last so WTS(A)=20) NOTE: In timestamp protocol , the transaction that enters into the system first will be completed first( We can say older transaction gets priority) TS = 10 TS=20 TS=30 T1 T2 T3 W(A ) W(A) W(A)

RULES OF TIMESTAMP PROTOCOL There are two rules of timestamp protocol : RULE 1 : (for READ Operation) Transaction Ti issues a READ operation if TS( Ti ) < WTS(X) then WR Rollback Ti READ after WRITE Else { perform READ(A) set RTS(A) = Max{ RTS(A) , TS( Ti ) } }

RULE 2 : ( for WRITE Operation ) Transaction Ti issues a WRITE operation If TS( Ti ) < RTS(X ) then RW Rollback Ti WRITE after READ Else If (TS ( Ti ) < WTS(X) ) then WW Rollback Ti WRITE after WRITE Else { perform WRITE(A) set WTS(A) = TS( Ti ) }

Q. Find R1(A), R2(A), W1(A) and W2(A) Let T1 =100 T2 = 200 According to rules of TSP- We’ll apply RULE 1 (READ Operation) for R1(A) and R2(A) Initially , RTS =0, WTS=0 TS ( T1) < WTS(A ) 100<0 (False) R1(A) performs RTS (A)= Max(0,100) =100 RTS(A) = 200 Again for R2 200<0 (False) R2(A ) performs RTS (A)= Max(100,200) = 200

We’ll apply RULE 1 (WRITE Operation ) for W1(A ) and W2(A ) Now, RTS =200 WTS=0 TS( T1) < RTS(A) 100<0 (False) TS ( T1) < WTS(A) 100<0 (False) W1(A) performs WTS (A ) =100 W TS(A ) = 200 Again for W2 200<0 (False) TS( T2) < WTS(A) (false) 200<0 W2(A ) performs WTS(A )= 200

Thank You