1 martin vechev ibm t.j. watson research center joint work with: hagit attiya, rachid guerraoui,...
Post on 20-Dec-2015
212 views
TRANSCRIPT
![Page 1: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/1.jpg)
LAWS OF ORDER: EXPENSIVE SYNCHRONIZATION IN CONCURRENT ALGORITHMS CANNOT BE ELIMINATED
1
Martin Vechev IBM T.J. Watson Research Center
Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael
![Page 2: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/2.jpg)
2
Concurrency
…is about synchronization
![Page 3: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/3.jpg)
3
Synchronization
but how much ?
![Page 4: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/4.jpg)
4
Synchronization
we don’t know
![Page 5: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/5.jpg)
5
Synchronization
manual empirical process
![Page 6: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/6.jpg)
6
Synchronization
time consuming
![Page 7: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/7.jpg)
7
Synchronization
too much is inefficient
![Page 8: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/8.jpg)
8
Synchronization
too little is incorrect
![Page 9: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/9.jpg)
9
Example: Set ADT
bool add(int key){ ???}
bool remove(int key){ ???}
bool contains(int key){ ???}
![Page 10: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/10.jpg)
10
Our Result
Concurrent abstract data types (stacks, queues, sets, hash tables,
counters …)
and mutual exclusion algorithms
must use expensive synchronization
![Page 11: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/11.jpg)
11
Implications
concurrent programming:
guidance on when avoiding expensive synchronization is futile
![Page 12: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/12.jpg)
12
“…although I hope that these shortcomings will be addressed, I hasten to add that they are insignificant compared to the huge step forward that this paper represents….”
-- Linux Weekly News, Jan 26, 2011
https://lwn.net/Articles/423994/
Implications
![Page 13: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/13.jpg)
13
Implications
hardware design:
motivation to lower cost of specific synchronization
![Page 14: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/14.jpg)
14
Implications
API design:
API specification affects synchronization
![Page 15: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/15.jpg)
15
Implications
program verification:
- declare incorrect when synchronization is missing - simplify verification under weak memory models
![Page 16: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/16.jpg)
16
What expensive synchronization?
order: read-after-write
![Page 17: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/17.jpg)
17
... write X read Y ...
read Ywrite X
modern architectures/languages
Read-after write
reordering
... write X fence read Y
Fence: enforce order
Example: Read-after-Write
![Page 18: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/18.jpg)
18
What expensive synchronization?
atomicity: atomic write-after-read
![Page 19: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/19.jpg)
Atomic Write-after-Read
... read X write Y ...
... read X write X ...
Examples:compare-and-swapfetch-and-addread-modify-write
![Page 20: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/20.jpg)
20
Which abstract data types ?
Atomicity
DeterminismCommutativity
![Page 21: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/21.jpg)
21
Example: Set ADT
bool add(v) add v bool remove(v) remove v bool contains(v) check if v is in the set
![Page 22: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/22.jpg)
22
Example: Set ADT
Example Histories:
add(5): true; remove(5): true; … add(5): true; add(5): false; … add(5): true; contains(5): true; …
![Page 23: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/23.jpg)
23
specification of Set is deterministic
Example: Set ADT
![Page 24: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/24.jpg)
24
commutativity: a way to select methods
![Page 25: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/25.jpg)
25
select non-commutative methods
![Page 26: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/26.jpg)
26
method A is non-commutative if there exists another method B where:
A influences Band
B influences A
![Page 27: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/27.jpg)
27
bool add(v) is non-commutative:
Example: Set ADT
add(v) influences
add(v)
![Page 28: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/28.jpg)
28
Example: Set ADT
{} add(5): true; add(5): false;
(add influences add)
![Page 29: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/29.jpg)
29
bool remove (v) is non-commutative:
Example: Set ADT
remove (v) influences
remove(v)
![Page 30: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/30.jpg)
30
bool contains(v) is commutative:
Example: Set ADT
contains(v) does not influence add(v), remove(v) or contains(v)
![Page 31: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/31.jpg)
31
How about void add(v) ?
void add(v) is commutative
Example: Set ADT
nobody can influence void add(v)
![Page 32: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/32.jpg)
32
Atomicity
DeterminismCommutativity
Which abstract data types ?
![Page 33: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/33.jpg)
33
Linearizability
DeterminismCommutativity
Which abstract data types ?
![Page 34: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/34.jpg)
34
Linearizability:
when a concurrent implementation
is equivalent to a sequential specification
[Herlihy&Wing – TOPLAS’90][Filipovic et. al – ESOP 2009]
![Page 35: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/35.jpg)
35
Theorem
given: deterministic sequential
specification, non-commutative method M
then: any linearizable implementation of spec
contains sequential executions of M that use
RAW or AWAR
![Page 36: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/36.jpg)
36
bool add(int key){ ???}
bool remove(int key){ ???}
bool contains(int key){ ???}
Example: Set ADT
![Page 37: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/37.jpg)
37
Set specification is deterministic
bool remove(v) is non-commutative
Any linearizable implementation of remove (v) must have sequential
executions with RAW or AWAR
Example: Set ADT
![Page 38: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/38.jpg)
38
bool add(int key){ ???}
bool remove(int key){ RAW or AWAR}
bool contains(int key){ ???}
Example: Set ADT
![Page 39: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/39.jpg)
39
Set specification is deterministic
bool contains(v) is commutative
cannot say anything about contains(v)
Example: Set ADT
![Page 40: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/40.jpg)
40
bool add(int key){ ???}
bool remove(int key){ RAW or AWAR}
bool contains(int key){ ???}
Example: Set ADT
![Page 41: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/41.jpg)
41
Set specification is deterministic
bool add(v) is non-commutative
Any linearizable implementation of add(v) must have sequential
executions with RAW or AWAR
Example: Set ADT
![Page 42: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/42.jpg)
42
bool add(int key){ RAW or AWAR}
bool remove(int key){ RAW or AWAR}
bool contains(int key){ ???}
Example: Set ADT
![Page 43: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/43.jpg)
43
Proof Intuition: Writing
show a method must write
otherwise, it cannot influence anyone
hence, method would be commutative
![Page 44: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/44.jpg)
44
{}
Proof Intuition: Writing
add(5) true {}
no shared write
add(5) true
add(5) did not influence add(5)
![Page 45: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/45.jpg)
45
Proof Intuition: Reading
show a method must read
otherwise, it cannot be influenced by anyone
hence, method would be commutative
![Page 46: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/46.jpg)
46
Proof Intuition: RAW
{}
add(5)
trueadd(5)
true
W
no RAW
add(5) true trueadd(5)
Linearization
{}
![Page 47: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/47.jpg)
47
Summary
Atomicity (Linearizability)
DeterminismCommutativity
RAWAWAR
![Page 48: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/48.jpg)
48
Future Directions
Even when laws have been written down, they ought not always to remain unaltered -- Aristotle
![Page 49: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/49.jpg)
49
Future Directions
Algorithm Specialization:
Relax dimensions to obtain new algorithms
![Page 50: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/50.jpg)
50
Future Directions
Can the dimensions be weakened? (while keeping lower bound)
Sequential Consistency ? Weaker Commutativity ? Abstract Determinism ?
![Page 51: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/51.jpg)
51
Future Directions
Can the result by strengthened ?
write-write read-read
sequences of reads and writes composite operations
more (all) executions
![Page 52: 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael](https://reader030.vdocument.in/reader030/viewer/2022032800/56649d4e5503460f94a2dfb0/html5/thumbnails/52.jpg)
52
The End