1 / 6

Optimistic Concurrency Control

Optimistic Concurrency Control . 6.830 / 6.814 Lecture 14 10/27/2014. OCC Runtime. twrite ( n,i,v ): if n not in write_set // never written, make copy m = copy(n); copies[n] = m; write_set = write_set union {n}; write(copies[n], i , v))) tread ( n,i ):

Download Presentation

Optimistic Concurrency Control

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Optimistic Concurrency Control 6.830 / 6.814 Lecture 14 10/27/2014

  2. OCC Runtime twrite(n,i,v): if n not in write_set // never written, make copy m = copy(n); copies[n] = m; write_set = write_set union {n}; write(copies[n], i, v))) tread(n,i): read_set = read_set union {n}; if n in write_set return read(copies[n],i); else returnread(n,i);

  3. Validation Rules When Tjcompletes its read phase, require that for all Ti < Tj, one of the following conditions must be true for validation to succeed (Tj to commit): • Ti completes its write phase before Tj starts its read phase • W(Ti) does not intersect R(Tj), and Ti completes its write phase before Tj starts its write phase. • W(Ti) does not intersect R(Tj) or W(Tj), and Ti completes its read phase before Tj completes its read phase. • W(Ti) does not intersect R(Tj) or W(Tj), and W(Tj) does not intersect R(Ti) [no conflicts] These rules will ensure serializability, with Tj being ordered after Ti with respect to conflicts

  4. Condition 1 Ti completes its write phase before Tj starts its read phase Read Validate Write Ti Read Validate Write Tj Time Don't overlap at all.

  5. Condition 2 W(Ti) does not intersect R(Tj), and Ti completes its write phase before Tj starts its write phase. W(Ti) ∩ R(Tj) = { } R(Ti) ∩ W(Tj) ≠ { } W(Ti) ∩ W(Tj) ≠ { } Read Validate Write Ti Read Validate Write Tj Time Tj doesn’t read anything Ti wrote. Anything Tj wrote that Ti also wrote will be installed afterwards. Anything Ti read will not reflect Tjs writes

  6. Condition 3 W(Ti) does not intersect R(Tj) or W(Tj), and Ti completes its read phase before Tj completes its read phase. W(Ti) ∩ R(Tj) = { } R(Ti) ∩ W(Tj) ≠ { } W(Ti) ∩ W(Tj) = { } Read Validate Write Ti Read Validate Write Tj Time Tj doesn’t read or write anything Ti wrote (but Ti may read something Tj writes). Ti definitely won’t see any of Tj’s writes, because it finishes reading before Tj starts validation, so Ti ordered before Tj. Ti will always complete its read phase before Tj b/c timestamps assigned after read phase

More Related