Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael.

Similar presentations


Presentation on theme: "1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael."— Presentation transcript:

1 1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael

2 Concurrency 2 …is about synchronization

3 Synchronization 3 but how much ?

4 Synchronization 4 we don’t know

5 Synchronization 5 manual empirical process

6 Synchronization 6 time consuming

7 Synchronization 7 too much is inefficient

8 Synchronization 8 too little is incorrect

9 Example: Set ADT 9 bool add(int key) { ??? } bool remove(int key) { ??? } bool contains(int key) { ??? }

10 Our Result 10 Concurrent abstract data types (stacks, queues, sets, hash tables, counters …) and mutual exclusion algorithms must use expensive synchronization

11 Implications 11 concurrent programming: guidance on when avoiding expensive synchronization is futile

12 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

13 13 hardware design: motivation to lower cost of specific synchronization

14 Implications 14 API design: API specification affects synchronization

15 Implications 15 program verification: - declare incorrect when synchronization is missing - simplify verification under weak memory models

16 What expensive synchronization? 16 order: read-after-write

17 17... write X read Y... read Y write X modern architectures/languages Read-after write reordering... write X fence read Y Fence: enforce order Example: Read-after-Write

18 What expensive synchronization? 18 atomicity: atomic write-after-read

19 Atomic Write-after-Read... read X write Y... read X write X... Examples: compare-and-swap fetch-and-add read-modify-write

20 Which abstract data types ? 20 Atomicity Determinism Commutativity

21 Example: Set ADT 21 bool add(v) add v bool remove(v) remove v bool contains(v) check if v is in the set

22 22 Example: Set ADT Example Histories: add(5): true; remove(5): true; … add(5): true; add(5): false; … add(5): true; contains(5): true; …

23 23 specification of Set is deterministic Example: Set ADT

24 24 commutativity: a way to select methods

25 25 select non-commutative methods

26 26 method A is non-commutative if there exists another method B where: A influences B and B influences A

27 27 bool add(v) is non-commutative: Example: Set ADT add(v) influences add(v)

28 28 Example: Set ADT {} add(5): true; add(5): false; (add influences add)

29 29 bool remove (v) is non-commutative: Example: Set ADT remove (v) influences remove(v)

30 30 bool contains(v) is commutative: Example: Set ADT contains(v) does not influence add(v), remove(v) or contains(v)

31 31 How about void add(v) ? void add(v) is commutative Example: Set ADT nobody can influence void add(v)

32 32 Atomicity Determinism Commutativity Which abstract data types ?

33 33 Linearizability Determinism Commutativity Which abstract data types ?

34 34 Linearizability: when a concurrent implementation is equivalent to a sequential specification [Herlihy&Wing – TOPLAS’90] [Filipovic et. al – ESOP 2009]

35 Theorem 35 given: deterministic sequential specification, non-commutative method M then: any linearizable implementation of spec contains sequential executions of M that use RAW or AWAR

36 36 bool add(int key) { ??? } bool remove(int key) { ??? } bool contains(int key) { ??? } Example: Set ADT

37 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

38 38 bool add(int key) { ??? } bool remove(int key) { RAW or AWAR } bool contains(int key) { ??? } Example: Set ADT

39 39 Set specification is deterministic bool contains(v) is commutative cannot say anything about contains(v) Example: Set ADT

40 40 bool add(int key) { ??? } bool remove(int key) { RAW or AWAR } bool contains(int key) { ??? } Example: Set ADT

41 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

42 42 bool add(int key) { RAW or AWAR } bool remove(int key) { RAW or AWAR } bool contains(int key) { ??? } Example: Set ADT

43 43 Proof Intuition: Writing show a method must write otherwise, it cannot influence anyone hence, method would be commutative

44 44 {} Proof Intuition: Writing add(5)true {} no shared write add(5)true add(5) did not influence add(5)

45 45 Proof Intuition: Reading show a method must read otherwise, it cannot be influenced by anyone hence, method would be commutative

46 46 Proof Intuition: RAW {} add(5) true add(5) true W no RAW add(5)true add(5) Linearization {}

47 47 Summary Atomicity (Linearizability) Determinism Commutativity RAW AWAR

48 48 Future Directions Even when laws have been written down, they ought not always to remain unaltered -- Aristotle

49 49 Future Directions Algorithm Specialization: Relax dimensions to obtain new algorithms

50 50 Future Directions Can the dimensions be weakened? (while keeping lower bound) Sequential Consistency ? Weaker Commutativity ? Abstract Determinism ?

51 51 Future Directions Can the result by strengthened ? write-write read-read sequences of reads and writes composite operations more (all) executions

52 The End 52


Download ppt "1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael."

Similar presentations


Ads by Google