replication and consistency
play

Replication and Consistency Setting: Concurrent threads accessing - PowerPoint PPT Presentation

Replication and Consistency in and hardware general memory consistency models in particular Roland Meyer Technische Universit at Kaiserslautern Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 1 / 32


  1. Replication and Consistency Principles in hardware memory consistency models What can be relaxed: Program order PGAS +R/W RMO +R/R +W/W PSO TSO+W/R Very strange (and not in this talk): Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 8 / 32

  2. Replication and Consistency Principles in hardware memory consistency models What can be relaxed: Program order PGAS +R/W RMO +R/R +W/W PSO TSO+W/R Very strange (and not in this talk): Out-of-thin-air values — arise when threads consistently lie to each other Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 8 / 32

  3. Replication and Consistency Principles in hardware memory consistency models What can be relaxed: Program order + store order PGAS +NSA +R/W RMO +R/R +W/W PSO TSO+W/R Very strange (and not in this talk): Out-of-thin-air values — arise when threads consistently lie to each other Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 8 / 32

  4. Replication and Consistency Principles in hardware memory consistency models What can be relaxed: Program order + store order Power PGAS +NSA +R/W RMO +R/R +W/W PSO TSO+W/R Very strange (and not in this talk): Out-of-thin-air values — arise when threads consistently lie to each other Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 8 / 32

  5. Lines of Research Consistency models Axiomatic, programming language (herd) for consistency models (Alglave) Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 9 / 32

  6. Lines of Research Consistency models Axiomatic, programming language (herd) for consistency models (Alglave) Geo-replicated consistency Conflict-free replicated data types (Shapiro) Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 9 / 32

  7. Lines of Research Consistency models Axiomatic, programming language (herd) for consistency models (Alglave) Geo-replicated consistency Conflict-free replicated data types (Shapiro) C++11 Compilation (COMPCERT, ADVENT) Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 9 / 32

  8. Lines of Research Consistency models Axiomatic, programming language (herd) for consistency models (Alglave) Geo-replicated consistency Conflict-free replicated data types (Shapiro) C++11 Compilation (COMPCERT, ADVENT) Linearizability Semantics and algorithmics (Paderborn, Paris, Uppsala) Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 9 / 32

  9. Lines of Research Consistency models Axiomatic, programming language (herd) for consistency models (Alglave) Geo-replicated consistency Conflict-free replicated data types (Shapiro) C++11 Compilation (COMPCERT, ADVENT) Linearizability Semantics and algorithmics (Paderborn, Paris, Uppsala) Verification under relaxed consistency models Reachability and robustness (Paris, Uppsala, MSR, KL) Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 9 / 32

  10. Memory Consistency Models: TSO and SC Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 10 / 32

  11. Concurrent Programs with Shared Memory Finite number of shared variables { x , y , x 1 , . . . } Finite data domain { d , d 0 , d 1 , . . . } Finite number of finite-control threads T 1 , . . . , T n with operations: w ( x , d ) , r ( x , d ) x = y = 0 Thread 1 Thread 2 a : x = 1 p : y = 1 b : if ( y == 0) { q : if ( x == 0) { c : crit . sect . 1 r : crit . sect . 2 d : } s : } Dekker’s mutual exclusion protocol. Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 11 / 32

  12. Sequential Consistency (SC) Semantics [Lamport 1979] Threads directly write to and read from memory Classical interleaving semantics ◮ Computations of different threads are shuffled ◮ Program order is preserved for each thread Mem x = y = 0 Thread 1 x Thread 1 Thread 2 pc = a 0 a : x = 1 p : y = 1 b : if ( y == 0) { q : if ( x == 0) { y Thread 2 c : crit . sect . 1 r : crit . sect . 2 0 pc = p d : } s : } Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 12 / 32

  13. Sequential Consistency (SC) Semantics [Lamport 1979] Threads directly write to and read from memory Classical interleaving semantics ◮ Computations of different threads are shuffled ◮ Program order is preserved for each thread Mem x = y = 0 Thread 1 x Thread 1 Thread 2 pc = b 1 a : x = 1 p : y = 1 b : if ( y == 0) { q : if ( x == 0) { y Thread 2 c : crit . sect . 1 r : crit . sect . 2 0 pc = p d : } s : } isu · w ( x , 1) Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 12 / 32

  14. Sequential Consistency (SC) Semantics [Lamport 1979] Threads directly write to and read from memory Classical interleaving semantics ◮ Computations of different threads are shuffled ◮ Program order is preserved for each thread Mem x = y = 0 Thread 1 x Thread 1 Thread 2 pc = c 1 a : x = 1 p : y = 1 b : if ( y == 0) { q : if ( x == 0) { y Thread 2 c : crit . sect . 1 r : crit . sect . 2 0 pc = p d : } s : } isu · w ( x , 1) · r ( y , 0) Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 12 / 32

  15. Sequential Consistency (SC) Semantics [Lamport 1979] Threads directly write to and read from memory Classical interleaving semantics ◮ Computations of different threads are shuffled ◮ Program order is preserved for each thread Mem x = y = 0 Thread 1 x Thread 1 Thread 2 pc = c 1 a : x = 1 p : y = 1 b : if ( y == 0) { q : if ( x == 0) { y Thread 2 c : crit . sect . 1 r : crit . sect . 2 1 pc = q d : } s : } isu · w ( x , 1) · r ( y , 0) · isu · w ( y , 1) Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 12 / 32

  16. Sequential Consistency (SC) Semantics [Lamport 1979] Threads directly write to and read from memory Classical interleaving semantics ◮ Computations of different threads are shuffled ◮ Program order is preserved for each thread Mem x = y = 0 Mutual exclusion holds! Thread 1 x Thread 1 Thread 2 pc = c 1 a : x = 1 p : y = 1 b : if ( y == 0) { q : if ( x == 0) { y Thread 2 c : crit . sect . 1 r : crit . sect . 2 1 pc = q d : } s : } isu · w ( x , 1) · r ( y , 0) · isu · w ( y , 1) · � Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 12 / 32

  17. Total Store Ordering (TSO) Semantics [SPARC 1994, x86] Sequential Consistency forbids compiler and hardware optimizations Hence is not implemented by any processor Processors have various buffers to reduce latency of memory accesses Behavior captured by relaxed memory models Here: Total Store Ordering (TSO) memory model Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 13 / 32

  18. Total Store Ordering (TSO) Semantics [SPARC 1994, x86] TSO architectures have write buffers (FIFO) Read takes value from memory if no write to that variable is buffered Otherwise read value of last write to that variable in the buffer Mem x = y = 0 Thread 1 x Thread 1 Thread 2 pc = a 0 a : x = 1 p : y = 1 b : if ( y == 0) { q : if ( x == 0) { y Thread 2 c : crit . sect . 1 r : crit . sect . 2 0 pc = p d : } s : } Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 14 / 32

  19. Total Store Ordering (TSO) Semantics [SPARC 1994, x86] TSO architectures have write buffers (FIFO) Read takes value from memory if no write to that variable is buffered Otherwise read value of last write to that variable in the buffer Mem x = y = 0 Thread 1 x w ( x , 1) Thread 1 Thread 2 pc = b 0 a : x = 1 p : y = 1 b : if ( y == 0) { q : if ( x == 0) { y Thread 2 c : crit . sect . 1 r : crit . sect . 2 0 pc = p d : } s : } isu Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 14 / 32

  20. Total Store Ordering (TSO) Semantics [SPARC 1994, x86] TSO architectures have write buffers (FIFO) Read takes value from memory if no write to that variable is buffered Otherwise read value of last write to that variable in the buffer Mem x = y = 0 Thread 1 x w ( x , 1) Thread 1 Thread 2 pc = c 0 a : x = 1 p : y = 1 b : if ( y == 0) { q : if ( x == 0) { y Thread 2 c : crit . sect . 1 r : crit . sect . 2 0 pc = p d : } s : } isu · r ( y , 0) Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 14 / 32

  21. Total Store Ordering (TSO) Semantics [SPARC 1994, x86] TSO architectures have write buffers (FIFO) Read takes value from memory if no write to that variable is buffered Otherwise read value of last write to that variable in the buffer Mem x = y = 0 Thread 1 x w ( x , 1) Thread 1 Thread 2 pc = c 0 a : x = 1 p : y = 1 b : if ( y == 0) { q : if ( x == 0) { y Thread 2 w ( y , 1) c : crit . sect . 1 r : crit . sect . 2 0 pc = q d : } s : } isu · r ( y , 0) · isu Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 14 / 32

  22. Total Store Ordering (TSO) Semantics [SPARC 1994, x86] TSO architectures have write buffers (FIFO) Read takes value from memory if no write to that variable is buffered Otherwise read value of last write to that variable in the buffer Mem x = y = 0 Thread 1 x w ( x , 1) Thread 1 Thread 2 pc = c 0 a : x = 1 p : y = 1 b : if ( y == 0) { q : if ( x == 0) { y Thread 2 c : crit . sect . 1 r : crit . sect . 2 1 pc = q d : } s : } isu · r ( y , 0) · isu · w ( y , 1) Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 14 / 32

  23. Total Store Ordering (TSO) Semantics [SPARC 1994, x86] TSO architectures have write buffers (FIFO) Read takes value from memory if no write to that variable is buffered Otherwise read value of last write to that variable in the buffer Mem x = y = 0 Thread 1 x w ( x , 1) Thread 1 Thread 2 pc = c 0 a : x = 1 p : y = 1 b : if ( y == 0) { q : if ( x == 0) { y Thread 2 c : crit . sect . 1 r : crit . sect . 2 1 pc = r d : } s : } isu · r ( y , 0) · isu · w ( y , 1) · r ( x , 0) Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 14 / 32

  24. Total Store Ordering (TSO) Semantics [SPARC 1994, x86] TSO architectures have write buffers (FIFO) Read takes value from memory if no write to that variable is buffered Otherwise read value of last write to that variable in the buffer Mem x = y = 0 Thread 1 x Thread 1 Thread 2 pc = c 1 a : x = 1 p : y = 1 b : if ( y == 0) { q : if ( x == 0) { y Thread 2 c : crit . sect . 1 r : crit . sect . 2 1 pc = r d : } s : } isu · r ( y , 0) · isu · w ( y , 1) · r ( x , 0) · w ( x , 1) Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 14 / 32

  25. Total Store Ordering (TSO) Semantics [SPARC 1994, x86] TSO architectures have write buffers (FIFO) Read takes value from memory if no write to that variable is buffered Otherwise read value of last write to that variable in the buffer Mem x = y = 0 Mutual exclusion fails!!! Thread 1 x Thread 1 Thread 2 pc = c a : x = 1 p : y = 1 b : if ( y == 0) { q : if ( x == 0) { y Thread 2 c : crit . sect . 1 r : crit . sect . 2 1 pc = r d : } s : } isu · r ( y , 0) · isu · w ( y , 1) · r ( x , 0) · w ( x , 1) Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 14 / 32

  26. Total Store Ordering (TSO) Semantics [SPARC 1994, x86] TSO architectures have write buffers (FIFO) Read takes value from memory if no write to that variable is buffered Otherwise read value of last write to that variable in the buffer Mem x = y = 0 Thread 1 x Thread 1 Thread 2 pc = c a : x = 1 p : y = 1 b : if ( y == 0) { q : if ( x == 0) { y Thread 2 c : crit . sect . 1 r : crit . sect . 2 1 pc = r d : } s : } isu · r ( y , 0) · isu · w ( y , 1) · r ( x , 0) · w ( x , 1) Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 14 / 32

  27. Verification Required?! Relaxed executions may lead to bad behavior Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 15 / 32

  28. Verification Required?! Relaxed executions may lead to bad behavior If this is the real world, why does anything work? Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 15 / 32

  29. Verification Required?! Relaxed executions may lead to bad behavior If this is the real world, why does anything work? Theorem [Adve, Hill 1993] : If a program is data-race-free, then SC and TSO semantics coincide. Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 15 / 32

  30. Verification Required?! Relaxed executions may lead to bad behavior If this is the real world, why does anything work? Theorem [Adve, Hill 1993] : If a program is data-race-free, then SC and TSO semantics coincide. So, go and write data-race-free programs! Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 15 / 32

  31. Verification Required?! Relaxed executions may lead to bad behavior If this is the real world, why does anything work? Theorem [Adve, Hill 1993] : If a program is data-race-free, then SC and TSO semantics coincide. So, go and write data-race-free programs! Works in 90% of the cases Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 15 / 32

  32. Verification Required?! Relaxed executions may lead to bad behavior If this is the real world, why does anything work? Theorem [Adve, Hill 1993] : If a program is data-race-free, then SC and TSO semantics coincide. So, go and write data-race-free programs! Works in 90% of the cases Performance-critical code does have data races Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 15 / 32

  33. Verification Required?! Relaxed executions may lead to bad behavior If this is the real world, why does anything work? Theorem [Adve, Hill 1993] : If a program is data-race-free, then SC and TSO semantics coincide. So, go and write data-race-free programs! Works in 90% of the cases Performance-critical code does have data races Concurrency libraries Operating systems HPC@Fraunhofer ITWM Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 15 / 32

  34. Verification Required?! Relaxed executions may lead to bad behavior If this is the real world, why does anything work? Theorem [Adve, Hill 1993] : If a program is data-race-free, then SC and TSO semantics coincide. So, go and write data-race-free programs! Works in 90% of the cases Performance-critical code does have data races Concurrency libraries Operating systems HPC@Fraunhofer ITWM This is where our verification techniques apply Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 15 / 32

  35. Reachability [MSR, Oxford, Paris, Uppsala] Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 16 / 32

  36. State Reachability Problem Consider a memory model MM State Reachability Problem for MM Input : Program P and a (control + memory) state s. Problem : Is s reachable when P is run under MM? Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 17 / 32

  37. State Reachability Problem Consider a memory model MM State Reachability Problem for MM Input : Program P and a (control + memory) state s. Problem : Is s reachable when P is run under MM? Decidability / Complexity ? Each thread is finite-state For the SC memory model, this problem is PSPACE-complete Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 17 / 32

  38. State Reachability Problem Consider a memory model MM State Reachability Problem for MM Input : Program P and a (control + memory) state s. Problem : Is s reachable when P is run under MM? Decidability / Complexity ? Each thread is finite-state For the SC memory model, this problem is PSPACE-complete Non-trivial for relaxed memory models: Paths TSO ( P ) = Closure TSO ( Paths SC ( P )) is non-regular Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 17 / 32

  39. Robustness [IMDEA, Oxford, Paris, Uppsala] [ICALP’11, ESOP’13, ICALP’14, ACM TECS’15] Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 18 / 32

  40. Robustness [IMDEA, Oxford, Paris, Uppsala] [ICALP’11, ESOP’13, ICALP’14, ACM TECS’15] Decision procedure for robustness that Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 18 / 32

  41. Robustness [IMDEA, Oxford, Paris, Uppsala] [ICALP’11, ESOP’13, ICALP’14, ACM TECS’15] Decision procedure for robustness that applies to most memory models (checked TSO, PSO, PGAS, Power) Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 18 / 32

  42. Robustness [IMDEA, Oxford, Paris, Uppsala] [ICALP’11, ESOP’13, ICALP’14, ACM TECS’15] Decision procedure for robustness that applies to most memory models (checked TSO, PSO, PGAS, Power) gives precise complexity Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 18 / 32

  43. Robustness [IMDEA, Oxford, Paris, Uppsala] [ICALP’11, ESOP’13, ICALP’14, ACM TECS’15] Decision procedure for robustness that applies to most memory models (checked TSO, PSO, PGAS, Power) gives precise complexity ... but relies on a new automaton model and lots of guessing Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 18 / 32

  44. Robustness Idea: SC semantics is specification Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 19 / 32

  45. Robustness Idea: SC semantics is specification Relaxed behavior may contain bugs because programmers only had SC in mind Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 19 / 32

  46. Robustness Idea: SC semantics is specification Relaxed behavior may contain bugs because programmers only had SC in mind Every relaxed behavior has an SC equivalent (up to traces) Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 19 / 32

  47. Robustness Idea: SC semantics is specification Relaxed behavior may contain bugs because programmers only had SC in mind Every relaxed behavior has an SC equivalent (up to traces) Every relaxed behavior that deviates from SC is a programming error Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 19 / 32

  48. Robustness Idea: SC semantics is specification Relaxed behavior may contain bugs because programmers only had SC in mind Every relaxed behavior has an SC equivalent (up to traces) Every relaxed behavior that deviates from SC is a programming error Robustness Problem against relaxed memory model RMM Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 19 / 32

  49. Robustness Idea: SC semantics is specification Relaxed behavior may contain bugs because programmers only had SC in mind Every relaxed behavior has an SC equivalent (up to traces) Every relaxed behavior that deviates from SC is a programming error Robustness Problem against relaxed memory model RMM Input : Program P. Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 19 / 32

  50. Robustness Idea: SC semantics is specification Relaxed behavior may contain bugs because programmers only had SC in mind Every relaxed behavior has an SC equivalent (up to traces) Every relaxed behavior that deviates from SC is a programming error Robustness Problem against relaxed memory model RMM Input : Program P. Problem : Does Traces RMM ( P ) ⊆ Traces SC ( P ) hold? Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 19 / 32

  51. Robustness Idea: SC semantics is specification Relaxed behavior may contain bugs because programmers only had SC in mind Every relaxed behavior has an SC equivalent (up to traces) Every relaxed behavior that deviates from SC is a programming error Robustness Problem against relaxed memory model RMM Input : Program P. Problem : Does Traces RMM ( P ) ⊆ Traces SC ( P ) hold? Decidability / Complexity ? Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 19 / 32

  52. Robustness: General Solution Minimal Robust Violations = ∅ ? Computations RMM-computations Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 20 / 32

  53. Robustness: General Solution Minimal Robust Violations = ∅ ? Computations RMM-computations Combinatorics: Violations can be assumed to be in normal form Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 20 / 32

  54. Robustness: General Solution Minimal Robust Violations = ∅ ? Computations RMM-computations Combinatorics: Violations can be assumed to be in normal form Algorithmics: Check whether normal form violations exist Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 20 / 32

  55. Robustness: General Solution Together: Reduce robustness to an emptiness check ? L nf ∩ R cyc = ∅ . Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 21 / 32

  56. Robustness: General Solution Together: Reduce robustness to an emptiness check ? L nf ∩ R cyc = ∅ . Combinatorics: Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 21 / 32

  57. Robustness: General Solution Together: Reduce robustness to an emptiness check ? L nf ∩ R cyc = ∅ . Combinatorics: Violations to SC (if any) have a representative in normal form. Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 21 / 32

  58. Robustness: General Solution Together: Reduce robustness to an emptiness check ? L nf ∩ R cyc = ∅ . Combinatorics: Violations to SC (if any) have a representative in normal form. Algorithmics: Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 21 / 32

  59. Robustness: General Solution Together: Reduce robustness to an emptiness check ? L nf ∩ R cyc = ∅ . Combinatorics: Violations to SC (if any) have a representative in normal form. Algorithmics: Language L nf consists of all normal-form computations. Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 21 / 32

  60. Robustness: General Solution Together: Reduce robustness to an emptiness check ? L nf ∩ R cyc = ∅ . Combinatorics: Violations to SC (if any) have a representative in normal form. Algorithmics: Language L nf consists of all normal-form computations. ∩ R cyc filters only violating computations. Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 21 / 32

  61. Robustness: General Solution Together: Reduce robustness to an emptiness check ? L nf ∩ R cyc = ∅ . Combinatorics: Violations to SC (if any) have a representative in normal form. Algorithmics: Language L nf consists of all normal-form computations. ∩ R cyc filters only violating computations. ? Decide L nf ∩ R cyc = ∅ . Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 21 / 32

  62. Robustness: General Solution Reduce robustness to an emptiness check ? L nf ∩ R cyc = ∅ . Combinatorics: Violations to SC (if any) have a representative in normal form. Algorithmics: Language L nf consists of all normal-form computations. ∩ R cyc filters only violating computations. ? Decide L nf ∩ R cyc = ∅ . Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 22 / 32

  63. Combinatorics: Normal Form Violations Lemma (Shasha and Snir, 1988) A computation violates SC iff it has a cyclic happens-before relation. Thread 1 Thread 2 init x a : w(x, 1) d : r(x, 0) init y b : r(y, 0) c : w(y, 1) Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 23 / 32

  64. Combinatorics: Normal Form Violations Lemma (Shasha and Snir, 1988) A computation violates SC iff it has a cyclic happens-before relation. Happens-before relation of computation τ = isu · r ( y , 0) · isu · w ( y , 1) · r ( x , 0) · w ( x , 1) : Thread 1 Thread 2 init x a : w(x, 1) d : r(x, 0) init y b : r(y, 0) c : w(y, 1) Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 23 / 32

  65. Combinatorics: Normal Form Violations Lemma (Shasha and Snir, 1988) A computation violates SC iff it has a cyclic happens-before relation. Happens-before relation of computation τ = isu · r ( y , 0) · isu · w ( y , 1) · r ( x , 0) · w ( x , 1) : Thread 1 Thread 2 init x a : w(x, 1) d : r(x, 0) po po init y b : r(y, 0) c : w(y, 1) Program order Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 23 / 32

  66. Combinatorics: Normal Form Violations Lemma (Shasha and Snir, 1988) A computation violates SC iff it has a cyclic happens-before relation. Happens-before relation of computation τ = isu · r ( y , 0) · isu · w ( y , 1) · r ( x , 0) · w ( x , 1) : Thread 1 Thread 2 init x a : w(x, 1) d : r(x, 0) st po po init y b : r(y, 0) c : w(y, 1) st Program order, store order Roland Meyer (TU KL) Replication and Consistency IFIP WG 2.2 09/2016 23 / 32

Recommend


More recommend