A Simple Abstraction For Complex Concurrent Indexes
A Simple Abstraction For Complex Concurrent Indexes
OOPSLA 2011
Imperial College London: Pedro da Rocha Pinto, Thomas Dinsdale-Young, Philippa Gardner and Mark Wheelhouse University of Cambridge: Mike Dodds
Motivation
Indexes are ubiquitous in computing systems:
There are three basic operations on an index : r search(h,k) insert(h,k,v) remove(h,k)
This intuitive specification is not enough to reason about concurrent access to the index. e.g r search(h,k); insert(h,k1,r) || remove(h,k2)
with k1 k2
, , : there is a mapping in the index from to , and only the thread holding the predicate can modify .
, : there is no mapping in the index from , and only the thread holding the predicate can modify . Axioms:
e.g.
, , ,
, 1 (, 2 , ) r search(h,k); * , 1 (, 2 , ) = + , 1 = insert(h,k1,r) * (, 1 , ) +
(, 2 , ) remove(h,k2) * (, 2 ) +
, 1 , , 2
|| || ||
is analogous
is analogous
remove(h,k) * ,
* , + remove(h,k) * , +
, , ,
remove(h,k) * , +
Concurrent remove
(, , )1 (, , )1 , , 0.5 (, , )0.5
0.5
, ,
,
, ,
0.5
remove(h,k)
0.5
remove(h,k)
0.5
, 0.5 , (, )1
0.5
Combining Predicates
(, , ) (, , ) (, , )+ if + 1
(, , ) (, ) (, )+
if + 1
Sieve specification: * 2 , , 0
1
> 1 +
where m =
Our abstract concurrent index specification is sound for a number of different implementations, including:
Concurrent B-tree
9 - 44
3 - 22 38 44
8 44 66 71
1 - 4 10 20 22 22 L
2 22 37 38 38 L
7 38 40 42 44 44 L
4 44 52 62 66 66 L
6 66 68 71 71 L
5 71 77 85 93 L
Concurrent B-tree
B-tree remove implementation must satisfy the specification: , ,
1
remove(h,k) * ,
Concrete definition of (, , ) :
Shared state Interference environment
,
,
(, , ) = . , ,
RE M 0, k
LO C K
SW A P
IN S (0, k, v)
Capability tokens
(,)
Concurrent B-tree
Check axioms: for example, (, , ) , , Check stability of predicates Check implementations satisfy abstract specifications
, ,
if + 1
Concurrent B-tree
Proof of remove implementation:
Conclusion
Summary: simple abstract spec for concurrent indexes essence of real-world client programs correct implementations linked lists hash tables concurrent B-trees proof structure lends itself to automation Future work: Automation/Proof Assistant (Dinsdale-Young) java.util.concurrent (da Rocha Pinto) File Systems (Ntzik)