Proving Linearizability Using Partial Orders
Artem Khyzha Mike Dodds Alexey Gotsman Matthew Parkinson
The Kent Concurrency Workshop July 22nd 2016
Proving Linearizability Using Partial Orders Artem Khyzha Mike Dodds - - PowerPoint PPT Presentation
Proving Linearizability Using Partial Orders Artem Khyzha Mike Dodds Alexey Gotsman Matthew Parkinson The Kent Concurrency Workshop July 22 nd 2016 In this talk Algorithms posing challenges for the linearization points method: the
Artem Khyzha Mike Dodds Alexey Gotsman Matthew Parkinson
The Kent Concurrency Workshop July 22nd 2016
points method:
points method:
t1 t2 t3 e(‘b’) e(‘a’) e(‘c’) e(‘d’) d(?) e(‘a’) e(‘b’) e(‘c’) d(?) e(‘d’) for every concrete history find a linearization
Standard proof technique: linearization points for every concrete history t1 t2 t3 e(‘b’) e(‘a’) e(‘c’) e(‘d’) d(?) e(‘a’) e(‘b’) e(‘c’) d(?) e(‘d’) find a linearization
? = ‘b’ t1 t2 t3 e(‘b’) e(‘a’) e(‘c’) e(‘d’) d(?) e(‘a’) e(‘b’) e(‘c’) d(?) e(‘d’) for every concrete history find a linearization * *
concrete history t1 t2 t3 e(‘b’) e(‘a’) e(‘c’) e(‘d’) d(?)
where the linearization points of e(‘a’) and e(‘b’) are *
consumers) t1 t2 t3
‘d’ (3,4) ‘a’ (1,1) ‘b’ (2,3) ‘c’ (2,4)
t1 t2 t3
‘d’ (3,4) ‘a’ (1,1) ‘b’ (2,3) ‘c’ (2,4)
t1 t2 t3 e(‘b’) e(‘a’) e(‘c’) e(‘d’) d(?)
t1 t2 t3
‘d’ tsd
enqueue(Val v) { ts := newTimestamp(); insert(this_thread, v, ts); }
‘a’ tsa ‘b’ tsb ‘c’ tsc
t1 t2 t3
‘a’ tsa ‘d’ tsd ‘b’ tsb ‘c’ tsc
Val dequeue() { do { for each pool do { get the front node; update the candidate for removal; } if (there is a candidate) try removing it and returning its value; } while (true); }
t1 t2 t3
‘a’ tsa ‘d’ tsd ‘b’ tsb ‘c’ tsc
Val dequeue() { do { for each pool do { get the front node; update the candidate for removal; } if (there is a candidate) try removing it and returning its value; } while (true); }
t1 t2 t3
‘a’ tsa ‘d’ tsd ‘b’ tsb ‘c’ tsc
Val dequeue() { do { for each pool do { get the front node; update the candidate for removal; } if (there is a candidate) try removing it and returning its value; } while (true); } update the candidate for removal; by choosing the smallest timestamp
t1 t2 t3
‘a’ (1,2) ‘d’ (4,4) ‘b’ (1,2) ‘c’ (3,3)
t1 t2 t3 e(‘b’) e(‘a’) e(‘c’) e(‘d’) d(?)
t1 t2 t3
‘a’ (1,2) ‘d’ (4,4) ‘b’ (1,2) ‘c’ (3,3)
Val dequeue() { do { for each pool do { get the front node; update the candidate for removal; } if (there is a candidate) try removing it and returning its value; } while (true); } the smallest timestamp belongs to the “oldest” element
t1 t2 t3
‘a’ (1,2) ‘d’ (4,4) ‘b’ (1,2) ‘c’ (3,3)
determine till they are dequeued t1 t2 t3 e(‘b’) e(‘a’) e(‘c’) e(‘d’) d(‘?’)
choice via partial orders
sound
Optimistic Set
matching abstract history (instead of a linearization)
matching abstract history (instead of a linearization)
real-time order edges are added to the abstract history t1 t2 t3 e(‘b’) e(‘a’) e(‘c’) d(‘b’)
real-time order edges are added to the abstract history t1 t2 t3 e(‘b’) e(‘a’) e(‘c’) d(‘b’) e(‘a’) [“e(‘a’)” : t1, enq, ‘a’, TODO]
real-time order edges are added to the abstract history t1 t2 t3 e(‘b’) e(‘a’) e(‘c’) d(‘b’) e(‘a’) e(‘b’)
real-time order edges are added to the abstract history t1 t2 t3 e(‘b’) e(‘a’) e(‘c’) d(‘b’) e(‘a’) e(‘b’)
real-time order edges are added to the abstract history t1 t2 t3 e(‘b’) e(‘a’) e(‘c’) d(‘b’) e(‘a’) e(‘b’) e(‘c’) d(?)
enqueue(Val v) { ts := newTimestamp(); atomic { insert(this_thread, v, ts); } } E(this_event).rval := DONE; G[this_event] := ts;
elements of the data structure
with the FIFO policy in mind t1 t2 t3 e(‘b’) e(‘a’) e(‘c’) d(‘b’) e(‘a’) e(‘b’) e(‘c’) d(?)
with the FIFO policy in mind
e(‘a’) e(‘b’) e(‘c’) d(‘b’)
with the FIFO policy in mind
e(‘a’) e(‘b’) e(‘c’) d(‘b’)
with the FIFO policy in mind
e(‘a’) e(‘b’) e(‘c’) d(‘b’)
with the FIFO policy in mind d(?) e(‘a’) e(‘b’) e(‘c’) d(‘b’)
if (there is a candidate enq) { res := try removing enq; } } if (res != FAIL) { E(this_event).rval := res; R := (R U {(enq, this_event)} U {(enq, e’) | the value of e’ is in queue} U {(deq, d’} | d’ is an uncompleted dequeue})+;
possible without breaking acyclicity
removal is the minimal in the partial order
the partial order)
matching abstract history (instead of a linearization)
specification
linearization order
that are challenging with the linearization points method
Optimistic Set