Compositional reasoning about concurrent libraries
- n the axiomatic
TSO memory model
Artem Khyzha IMDEA Software Institute, Madrid, Spain
Joint work with Alexey Gotsman (IMDEA Software)
Compositional reasoning about concurrent libraries on the axiomatic - - PowerPoint PPT Presentation
Compositional reasoning about concurrent libraries on the axiomatic TSO memory model Artem Khyzha IMDEA Software Institute, Madrid, Spain Joint work with Alexey Gotsman (IMDEA Software) Weak memory x = y = 0; x = 1; y = 1; a = y; b = x;
Joint work with Alexey Gotsman (IMDEA Software)
x:a
x:a y:b
x:a y:b Writes flushed in FIFO order
y:b Writes flushed in FIFO order
Writes flushed in FIFO order
C
C
abstracted by
struct Node { Node *next; int val; } *T
void push(int v) { Node *t, *x; x = new Node; x->val = v; do { t = T
} while(!CAS(&T
} Sequence S; void push(int v) { atomic { S = v⋅S; } }
L (Implementation) L' (Specification)
C
C
linearized by
struct Node { Node *next; int val; } *T
void push(int v) { Node *t, *x; x = new Node; x->val = v; do { t = T
} while(!CAS(&T
} Sequence S; void push(int v) { atomic { S = v⋅S; } }
L (Implementation) L' (Specification) Linearizability [Herlihy, Wing]
po po
read y = 0 read x = 1 write x = 1 write y = 1
po po
po po mo rf rf
read y = 0 read x = 1
(x = 1) is flushed before (y = 1)
po po rf
rf mo
C L C L’
Any number of threads Any methods, in any order, with any parameters
rf po po
hb
rf po po
reasoning is possible on TSO.
implemented in SAT solvers
(IBM Power, ARM)
(t1, call push(42)) (t1, ret push) (t1, call isEmpty) (t2, call pop) (t2, ret pop(42))
(t2, call push(11)) (t2, ret push)
(t1, call push(42)) (t1, ret push) (t1, call isEmpty) (t1, ret isEmpty(yes)) (t2, call pop) (t2, ret pop(42)) (t2, call push(11)) (t2, ret push)
(t1, ret isEmpty(yes))