robustness against relaxed memory models
play

Robustness against Relaxed Memory Models Memory Models Roland - PowerPoint PPT Presentation

Robustness against Relaxed Memory Models Memory Models Roland Meyer Technische Universit at Kaiserslautern Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 1 / 27 Concurrent Programs with Shared Memory


  1. 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) Robustness against Relaxed Memory Models MM February 2015 6 / 27

  2. 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) Robustness against Relaxed Memory Models MM February 2015 6 / 27

  3. 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) Robustness against Relaxed Memory Models MM February 2015 6 / 27

  4. 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) Robustness against Relaxed Memory Models MM February 2015 6 / 27

  5. 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) Robustness against Relaxed Memory Models MM February 2015 6 / 27

  6. Robustness Idea: SC semantics is specification Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 7 / 27

  7. Robustness Idea: SC semantics is specification Relaxed behavior may contain bugs because programmers only had SC in mind Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 7 / 27

  8. 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) Robustness against Relaxed Memory Models MM February 2015 7 / 27

  9. 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) Robustness against Relaxed Memory Models MM February 2015 7 / 27

  10. 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) Robustness against Relaxed Memory Models MM February 2015 7 / 27

  11. 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) Robustness against Relaxed Memory Models MM February 2015 7 / 27

  12. 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) Robustness against Relaxed Memory Models MM February 2015 7 / 27

  13. 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) Robustness against Relaxed Memory Models MM February 2015 7 / 27

  14. Outline Shared Memory Concurrency 1 Sequential Consistency Semantics Total Store Ordering Semantics Robustness: General Solution 2 Combinatorics Algorithmics Robustness: Efficient Solution 3 Combinatorics Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 8 / 27

  15. Robustness: General Solution [Calin, Derevenetc, Majumdar, M., FSTTCS’13] [Derevenetc, M., ICALP’14] Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 9 / 27

  16. Robustness: General Solution [Calin, Derevenetc, Majumdar, M., FSTTCS’13] [Derevenetc, M., ICALP’14] Decision procedure for robustness that Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 9 / 27

  17. Robustness: General Solution [Calin, Derevenetc, Majumdar, M., FSTTCS’13] [Derevenetc, M., ICALP’14] Decision procedure for robustness that applies to most memory models (checked TSO, PSO, PGAS, Power) Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 9 / 27

  18. Robustness: General Solution [Calin, Derevenetc, Majumdar, M., FSTTCS’13] [Derevenetc, M., ICALP’14] Decision procedure for robustness that applies to most memory models (checked TSO, PSO, PGAS, Power) gives precise complexity Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 9 / 27

  19. Robustness: General Solution [Calin, Derevenetc, Majumdar, M., FSTTCS’13] [Derevenetc, M., ICALP’14] 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) Robustness against Relaxed Memory Models MM February 2015 9 / 27

  20. Robustness: General Solution Minimal Robust Violations = ∅ ? Computations RMM-computations Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 10 / 27

  21. Robustness: General Solution Minimal Robust Violations = ∅ ? Computations RMM-computations Combinatorics: Violations can be assumed to be in normal form Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 10 / 27

  22. 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) Robustness against Relaxed Memory Models MM February 2015 10 / 27

  23. 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 Together: Reduce robustness to an emptiness check ? L nf ∩ R cyc = ∅ . Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 10 / 27

  24. Robustness: General Solution Reduce robustness to an emptiness check ? L nf ∩ R cyc = ∅ . Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 11 / 27

  25. Robustness: General Solution Reduce robustness to an emptiness check ? L nf ∩ R cyc = ∅ . Combinatorics: Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 11 / 27

  26. 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. Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 11 / 27

  27. 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: Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 11 / 27

  28. 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. Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 11 / 27

  29. 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. Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 11 / 27

  30. 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) Robustness against Relaxed Memory Models MM February 2015 11 / 27

  31. 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) Robustness against Relaxed Memory Models MM February 2015 12 / 27

  32. 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 a : w(x, 1) d : r(x, 0) init x init y b : r(y, 0) c : w(y, 1) Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 13 / 27

  33. 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 a : w(x, 1) d : r(x, 0) init x init y b : r(y, 0) c : w(y, 1) Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 13 / 27

  34. 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 a : w(x, 1) d : r(x, 0) init x po po init y b : r(y, 0) c : w(y, 1) Program order Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 13 / 27

  35. 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 a : w(x, 1) d : r(x, 0) init x st po po init y b : r(y, 0) c : w(y, 1) st Program order, store order Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 13 / 27

  36. 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 src a : w(x, 1) d : r(x, 0) init x st po po src init y b : r(y, 0) c : w(y, 1) st Program order, store order, source relation Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 13 / 27

  37. 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 src a : w(x, 1) d : r(x, 0) init x st cf po po src cf init y b : r(y, 0) c : w(y, 1) st Program order, store order, source relation, conflict relation Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 13 / 27

  38. Combinatorics: Normal Form Violations Normal Form: Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 14 / 27

  39. Combinatorics: Normal Form Violations Normal Form: Computation has two parts τ = τ 1 · τ 2 Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 14 / 27

  40. Combinatorics: Normal Form Violations Normal Form: Computation has two parts τ = τ 1 · τ 2 Delays in τ 2 respect ordering in τ 1 Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 14 / 27

  41. Combinatorics: Normal Form Violations Normal Form: Computation has two parts τ = τ 1 · τ 2 Delays in τ 2 respect ordering in τ 1 In normal form . . . w ( x , 1) . . . w ( y , 1) . . . . . . isu . . . isu . . . ⏟ ⏞ ⏟ ⏞ τ 1 τ 2 Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 14 / 27

  42. Combinatorics: Normal Form Violations Normal Form: Computation has two parts τ = τ 1 · τ 2 Delays in τ 2 respect ordering in τ 1 In normal form . . . w ( x , 1) . . . w ( y , 1) . . . . . . isu . . . isu . . . ⏟ ⏞ ⏟ ⏞ τ 1 τ 2 Not in normal form . . . w ( y , 1) . . . w ( x , 1) . . . . . . isu . . . isu . . . ⏟ ⏞ ⏟ ⏞ τ 1 τ 2 Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 14 / 27

  43. Combinatorics: Normal Form Violations Theorem (Normal form): If a program is not robust, it has a violation in normal form. Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 15 / 27

  44. Combinatorics: Normal Form Violations Theorem (Normal form): If a program is not robust, it has a violation in normal form. Proof: Take a shortest computation τ with cyclic happens-before relation. Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 15 / 27

  45. Combinatorics: Normal Form Violations Theorem (Normal form): If a program is not robust, it has a violation in normal form. Proof: Take a shortest computation τ with cyclic happens-before relation. There is (may be non-trivial, depending on RMM) an event that can be cancelled: τ = τ 1 · a · τ 2 . Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 15 / 27

  46. Combinatorics: Normal Form Violations Theorem (Normal form): If a program is not robust, it has a violation in normal form. Proof: Take a shortest computation τ with cyclic happens-before relation. There is (may be non-trivial, depending on RMM) an event that can be cancelled: τ = τ 1 · a · τ 2 . Computation τ 1 · τ 2 is shorter Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 15 / 27

  47. Combinatorics: Normal Form Violations Theorem (Normal form): If a program is not robust, it has a violation in normal form. Proof: Take a shortest computation τ with cyclic happens-before relation. There is (may be non-trivial, depending on RMM) an event that can be cancelled: τ = τ 1 · a · τ 2 . Computation τ 1 · τ 2 is shorter, hence not violating. Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 15 / 27

  48. Combinatorics: Normal Form Violations Theorem (Normal form): If a program is not robust, it has a violation in normal form. Proof: Take a shortest computation τ with cyclic happens-before relation. There is (may be non-trivial, depending on RMM) an event that can be cancelled: τ = τ 1 · a · τ 2 . Computation τ 1 · τ 2 is shorter, hence not violating. There is an SC computation σ with same happens-before relation. Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 15 / 27

  49. Combinatorics: Normal Form Violations Theorem (Normal form): If a program is not robust, it has a violation in normal form. Proof: Take a shortest computation τ with cyclic happens-before relation. There is (may be non-trivial, depending on RMM) an event that can be cancelled: τ = τ 1 · a · τ 2 . Computation τ 1 · τ 2 is shorter, hence not violating. There is an SC computation σ with same happens-before relation. Now ( σ ↓ τ 1 ) · a · ( σ ↓ τ 2 ) Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 15 / 27

  50. Combinatorics: Normal Form Violations Theorem (Normal form): If a program is not robust, it has a violation in normal form. Proof: Take a shortest computation τ with cyclic happens-before relation. There is (may be non-trivial, depending on RMM) an event that can be cancelled: τ = τ 1 · a · τ 2 . Computation τ 1 · τ 2 is shorter, hence not violating. There is an SC computation σ with same happens-before relation. Now ( σ ↓ τ 1 ) · a · ( σ ↓ τ 2 ) is in normal form Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 15 / 27

  51. Combinatorics: Normal Form Violations Theorem (Normal form): If a program is not robust, it has a violation in normal form. Proof: Take a shortest computation τ with cyclic happens-before relation. There is (may be non-trivial, depending on RMM) an event that can be cancelled: τ = τ 1 · a · τ 2 . Computation τ 1 · τ 2 is shorter, hence not violating. There is an SC computation σ with same happens-before relation. Now ( σ ↓ τ 1 ) · a · ( σ ↓ τ 2 ) is in normal form and violating. Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 15 / 27

  52. 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) Robustness against Relaxed Memory Models MM February 2015 16 / 27

  53. Algorithmics: Generating Normal-Form Computations Challenge Describe language L nf of all normal-form computations Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 17 / 27

  54. Algorithmics: Generating Normal-Form Computations Challenge Describe language L nf of all normal-form computations Need a language class that Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 17 / 27

  55. Algorithmics: Generating Normal-Form Computations Challenge Describe language L nf of all normal-form computations Need a language class that includes L nf , Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 17 / 27

  56. Algorithmics: Generating Normal-Form Computations Challenge Describe language L nf of all normal-form computations Need a language class that includes L nf , is closed under regular intersection ( L nf ∩ R cyc ), Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 17 / 27

  57. Algorithmics: Generating Normal-Form Computations Challenge Describe language L nf of all normal-form computations Need a language class that includes L nf , is closed under regular intersection ( L nf ∩ R cyc ), ? has decidable emptiness problem ( L nf ∩ R cyc = ∅ ). Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 17 / 27

  58. Algorithmics: Generating Normal-Form Computations Challenge Describe language L nf of all normal-form computations Need a language class that includes L nf , is closed under regular intersection ( L nf ∩ R cyc ), ? has decidable emptiness problem ( L nf ∩ R cyc = ∅ ). Properties of L nf Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 17 / 27

  59. Algorithmics: Generating Normal-Form Computations Challenge Describe language L nf of all normal-form computations Need a language class that includes L nf , is closed under regular intersection ( L nf ∩ R cyc ), ? has decidable emptiness problem ( L nf ∩ R cyc = ∅ ). Properties of L nf Number of concurrently executed instructions is unbounded Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 17 / 27

  60. Algorithmics: Generating Normal-Form Computations Challenge Describe language L nf of all normal-form computations Need a language class that includes L nf , is closed under regular intersection ( L nf ∩ R cyc ), ? has decidable emptiness problem ( L nf ∩ R cyc = ∅ ). Properties of L nf Number of concurrently executed instructions is unbounded May include computations like isu n · w ( x , 1) n Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 17 / 27

  61. Algorithmics: Generating Normal-Form Computations Challenge Describe language L nf of all normal-form computations Need a language class that includes L nf , is closed under regular intersection ( L nf ∩ R cyc ), ? has decidable emptiness problem ( L nf ∩ R cyc = ∅ ). Properties of L nf Number of concurrently executed instructions is unbounded May include computations like isu n · w ( x , 1) n ⇒ not regular Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 17 / 27

  62. Algorithmics: Generating Normal-Form Computations Solution Define L nf as language of a multiheaded automaton . . . isu . . . isu . . . . . . w ( x , 1) . . . w ( y , 1) . . . ⏟ ⏞ ⏟ ⏞ τ 1 τ 2 Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 18 / 27

  63. Algorithmics: Generating Normal-Form Computations Solution Define L nf as language of a multiheaded automaton Multiheaded automata . . . isu . . . isu . . . . . . w ( x , 1) . . . w ( y , 1) . . . ⏟ ⏞ ⏟ ⏞ τ 1 τ 2 Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 18 / 27

  64. Algorithmics: Generating Normal-Form Computations Solution Define L nf as language of a multiheaded automaton Multiheaded automata Extension of NFA . . . isu . . . isu . . . . . . w ( x , 1) . . . w ( y , 1) . . . ⏟ ⏞ ⏟ ⏞ τ 1 τ 2 Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 18 / 27

  65. Algorithmics: Generating Normal-Form Computations Solution Define L nf as language of a multiheaded automaton Multiheaded automata Extension of NFA Generates parts τ 1 and τ 2 of a computation τ 1 · τ 2 simultaneously . . . isu . . . isu . . . . . . w ( x , 1) . . . w ( y , 1) . . . ⏟ ⏞ ⏟ ⏞ τ 1 τ 2 Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 18 / 27

  66. Algorithmics: Generating Normal-Form Computations Solution Define L nf as language of a multiheaded automaton Multiheaded automata Extension of NFA Generates parts τ 1 and τ 2 of a computation τ 1 · τ 2 simultaneously 1 , a 2 , b → q ′ and q → q ′ labeled by head i = 1 , 2 − − − − Transitions q . . . isu . . . isu . . . . . . w ( x , 1) . . . w ( y , 1) . . . ⏟ ⏞ ⏟ ⏞ τ 1 τ 2 Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 18 / 27

  67. Algorithmics: Generating Normal-Form Computations Solution Define L nf as language of a multiheaded automaton Multiheaded automata Extension of NFA Generates parts τ 1 and τ 2 of a computation τ 1 · τ 2 simultaneously 1 , a 2 , b → q ′ and q → q ′ labeled by head i = 1 , 2 − − − − Transitions q Example: . . . isu . . . isu . . . . . . w ( x , 1) . . . w ( y , 1) . . . ⏟ ⏞ ⏟ ⏞ τ 1 τ 2 Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 18 / 27

  68. Algorithmics: Generating Normal-Form Computations Solution Define L nf as language of a multiheaded automaton Multiheaded automata Extension of NFA Generates parts τ 1 and τ 2 of a computation τ 1 · τ 2 simultaneously 1 , a → q ′ and q 2 , b → q ′ labeled by head i = 1 , 2 Transitions q − − − − Example: ↑ . . . w ( x , 1) . . . w ( y , 1) . . . ↑ . . . isu . . . isu . . . ⏟ ⏞ ⏟ ⏞ τ 1 τ 2 Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 18 / 27

  69. Algorithmics: Generating Normal-Form Computations Solution Define L nf as language of a multiheaded automaton Multiheaded automata Extension of NFA Generates parts τ 1 and τ 2 of a computation τ 1 · τ 2 simultaneously 1 , a → q ′ and q 2 , b → q ′ labeled by head i = 1 , 2 Transitions q − − − − Example: ↑ . . . w ( x , 1) . . . w ( y , 1) . . . . . . ↑ isu . . . isu . . . ⏟ ⏞ ⏟ ⏞ τ 1 τ 2 Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 18 / 27

  70. Algorithmics: Generating Normal-Form Computations Solution Define L nf as language of a multiheaded automaton Multiheaded automata Extension of NFA Generates parts τ 1 and τ 2 of a computation τ 1 · τ 2 simultaneously 1 , a → q ′ and q 2 , b → q ′ labeled by head i = 1 , 2 Transitions q − − − − Example: . . . ↑ w ( x , 1) . . . w ( y , 1) . . . . . . ↑ isu . . . isu . . . ⏟ ⏞ ⏟ ⏞ τ 1 τ 2 Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 18 / 27

  71. Algorithmics: Generating Normal-Form Computations Solution Define L nf as language of a multiheaded automaton Multiheaded automata Extension of NFA Generates parts τ 1 and τ 2 of a computation τ 1 · τ 2 simultaneously 1 , a 2 , b → q ′ and q → q ′ labeled by head i = 1 , 2 Transitions q − − − − Example: . . . ↑ w ( x , 1) . . . w ( y , 1) . . . . . . ↑ isu . . . isu . . . ⏟ ⏞ ⏟ ⏞ τ 1 τ 2 1 , isu 2 , w ( x , 1) − − − → q 2 − − − − − → q 3 Transitions: q 1 Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 18 / 27

  72. Algorithmics: Generating Normal-Form Computations Solution Define L nf as language of a multiheaded automaton Multiheaded automata Extension of NFA Generates parts τ 1 and τ 2 of a computation τ 1 · τ 2 simultaneously 1 , a 2 , b → q ′ and q → q ′ labeled by head i = 1 , 2 Transitions q − − − − Example: . . . ↑ w ( x , 1) . . . w ( y , 1) . . . . . . isu ↑ . . . isu . . . ⏟ ⏞ ⏟ ⏞ τ 1 τ 2 1 , isu 2 , w ( x , 1) − − − → q 2 − − − − − → q 3 Transitions: q 1 Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 18 / 27

  73. Algorithmics: Generating Normal-Form Computations Solution Define L nf as language of a multiheaded automaton Multiheaded automata Extension of NFA Generates parts τ 1 and τ 2 of a computation τ 1 · τ 2 simultaneously 1 , a 2 , b → q ′ and q → q ′ labeled by head i = 1 , 2 Transitions q − − − − Example: . . . w ( x , 1) ↑ . . . w ( y , 1) . . . . . . isu ↑ . . . isu . . . ⏟ ⏞ ⏟ ⏞ τ 1 τ 2 1 , isu 2 , w ( x , 1) − − − → q 2 − − − − − → q 3 Transitions: q 1 Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 18 / 27

  74. 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) Robustness against Relaxed Memory Models MM February 2015 19 / 27

  75. Algorithmics: Checking Cyclicity Happens-before relation from the example: Thread 1 Thread 2 src a : w(x, 1) d : r(x, 0) init x st cf po po src cf init y b : r(y, 0) c : w(y, 1) st Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 20 / 27

  76. Algorithmics: Checking Cyclicity Happens-before relation from the example: Thread 1 Thread 2 src a : w(x, 1) d : r(x, 0) init x st cf po po src cf init y b : r(y, 0) c : w(y, 1) st Checking cyclicity Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 20 / 27

  77. Algorithmics: Checking Cyclicity Happens-before relation from the example: Thread 1 Thread 2 src a : w(x, 1) d : r(x, 0) init x st cf po po src cf init y b : r(y, 0) c : w(y, 1) st Checking cyclicity Finitely many types of cycles Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 20 / 27

  78. Algorithmics: Checking Cyclicity Happens-before relation from the example: Thread 1 Thread 2 src a : w(x, 1) d : r(x, 0) init x st cf po po src cf init y b : r(y, 0) c : w(y, 1) st Checking cyclicity Finitely many types of cycles Guess per thread two instructions in program order Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 20 / 27

  79. Algorithmics: Checking Cyclicity Happens-before relation from the example: Thread 1 Thread 2 src a : w(x, 1) d : r(x, 0) init x st cf po po src cf init y b : r(y, 0) c : w(y, 1) st Checking cyclicity Finitely many types of cycles Guess per thread two instructions in program order Finite automata check edges between guessed instructions from different threads Roland Meyer (TU KL) Robustness against Relaxed Memory Models MM February 2015 20 / 27

  80. 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) Robustness against Relaxed Memory Models MM February 2015 21 / 27

Recommend


More recommend