




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





CS 347 Notes05 7
CS 347 Notes05 8
CS 347 Notes05 9
CS 347 Notes05 10
CS 347 Notes05 11
CS 347 Notes05 12
locks for D 1
scheduler 1
locks for D 2
scheduler 2
CS 347 Notes05 13
locks for D 1
scheduler 1
locks for D 2
scheduler 2
access &lock data lock dataaccess & (release all locks at end) CS 347 Notes05 14
CS 347 Notes05 15
CS 347 Notes05 17
CS 347 Notes05 25
CS 347 Notes05 26
(Node X) (Node Y)
CS 347 Notes05 27
(Node X) (Node Y)
CS 347 Notes05 28
rL[X]: # of transactions currently reading X (0,1,2,…) wL[X]: # of transactions currently writing X (0 or 1)
CS 347 Notes05 29
ri[X] arrives IF ts(Ti) < MAX_W[X] THEN ABORT Ti
IF queue is empty AND wL[X] = 0 THEN
ELSE add (r, T i) to queue]
CS 347 Notes05 30
W i[X] arrives IF ts(Ti) < MAX_W[X] OR ts(Ti) < MAX_R[X] THEN ABORT Ti
IF queue is empty AND wL[X]=0 AND rL[X]=
WAIT FOR Ti TO FINISH ] ELSE add (w, T i) to queue ]
CS 347 Notes05 31
When o finishes (o is r or w) on X
[ let head of queue be (q, Tj );(smallest timestamp) IF q=w AND rL[X]=0 AND wL[X]=0 THEN
WRITE X AND WAIT FOR T j TO FINISH ] ELSE IF q=r AND wL[X]=0 THEN
CS 347 Notes05 32
WAIT FOR Ti TO FINISH ]
CS 347 Notes05 33
MAX_R[X]=10 T ts(T)= MAX_W[X]=
read X.. .
CS 347 Notes05 34
MAX_R[X]=10 T ts(T)= MAX_W[X]=
read X.. .
ts(T)=
CS 347 Notes05 35
CS 347 Notes05 36
IF ts(Ti)<MAX_R[X] THEN ABORT Ti ELSE IF ts(Ti)<MAX_W[X] THEN [IGNORE THIS WRITE (tell Ti it was OK)] ELSE [process write as before…
IF queue is empty AND wL[X]=0 AND rL[X] =0 THEN
ELSE add (W, Ti) to queue]
MAX_R[X] MAX_W[X] ts(Ti ) Ti wants to write X
CS 347 Notes05 43
CS 347 Notes05 44
CS 347 Notes05 45
Item data MAX_R MAX_W
CS 347 Notes05 46
Item MAX_R MAX_W
tsMIN
CS 347 Notes05 47
CS 347 Notes05 48
D 1 ts cache
scheduler 1
D 2 ts cache
scheduler 2
CS 347 Notes05 49
D 1 ts cache
scheduler 1
D 2 ts cache
scheduler 2
access data access data
CS 347 Notes05 51
hard to not very practical implement in need global data a distributed structure system