Statistical Analysis of Non-Deterministic Fork-Join Processes task - - PowerPoint PPT Presentation

statistical analysis of non deterministic fork join
SMART_READER_LITE
LIVE PREVIEW

Statistical Analysis of Non-Deterministic Fork-Join Processes task - - PowerPoint PPT Presentation

Martin Ppin Joint work with Antoine Genitrini & Frdric Peschanski Accepted for publication at ICTAC20 October 13, 2020 Sorbonne Universit LIP6 Paris Statistical Analysis of Non-Deterministic Fork-Join Processes task 1


slide-1
SLIDE 1

Statistical Analysis of Non-Deterministic Fork-Join Processes

Martin Pépin

Joint work with Antoine Genitrini & Frédéric Peschanski Accepted for publication at ICTAC’20

October 13, 2020

Sorbonne Université — LIP6 — Paris

slide-2
SLIDE 2

What is concurrency?

task 1 task 1 task 1 task 2 task 2 task 2 task 3 task 3 Time

One computation unit shared by several processes: → Possible dependencies between processes → Scheduling

1/15

slide-3
SLIDE 3

Why is it diffjcult?

You would like to check that all possible schedulings are correct. “all schedulings” → Combinatorics!

  • Many possible schedulings: combinatorial explosion
  • Can we (effjciently) count them?
  • Can we (effjciently) sample among them?

2/15

slide-4
SLIDE 4

Why is it diffjcult?

You would like to check that all possible schedulings are correct. “all schedulings” → Combinatorics!

  • Many possible schedulings: combinatorial explosion
  • Can we (effjciently) count them?
  • Can we (effjciently) sample among them?

2/15

slide-5
SLIDE 5

Why is it diffjcult?

You would like to check that all possible schedulings are correct. “all schedulings” → Combinatorics!

  • Many possible schedulings: combinatorial explosion
  • Can we (effjciently) count them?
  • Can we (effjciently) sample among them?

2/15

slide-6
SLIDE 6

Why is it diffjcult? (2)

Negative result (Brightwell & Winkler ’91) Counting the linear extensions of a partial order is a #-P complete problem. I.e. it is as hard as counting the number of solutions in SAT. So we cannot count effjciently… in the general case. But we can have some restrictions on the programs.

3/15

slide-7
SLIDE 7

Why is it diffjcult? (2)

Negative result (Brightwell & Winkler ’91) Counting the linear extensions of a partial order is a #-P complete problem. I.e. it is as hard as counting the number of solutions in SAT. So we cannot count effjciently… in the general case. But we can have some restrictions on the programs.

3/15

slide-8
SLIDE 8

The long-term project “Quantitative and algorithmic aspects of concurrency”

> Olivier Bodini, Matthieu Dien, Antoine Genitrini, MP, Frédéric Peschanski, … > Identify fundamental components of concurrency and interpret them as combinatorial objects > Algorithmic solutions for the counting and sampling problems > Analytical results (when possible)

4/15

slide-9
SLIDE 9

Outline

A class of concurrent programs Algorithmic aspects Conclusion and perspective

slide-10
SLIDE 10

Fork-Join parallelism

Parallel composition P Q

task 1 task 2 task 3

task 1 task 2

task 1 task 1 task 2 task 3 task 2

Execution = any interleaving

  • f an execution of P and an

execution of Q. Sequential composition P Q

task 1 task 2 task 3

;

task 1 task 2

task 1 task 2 task 3 task 1 task 2

Execution = an execution of P followed by an execution of Q.

5/15

slide-11
SLIDE 11

Non-determinism and loops

Non-deterministic choice P Q

task 1 task 2 task 3

+

task 1 task 2

task 1 task 2 task 3

  • r

task 1 task 2

Execution = an execution of P

  • r an execution of Q.

Loop (

task 1 task 2

)⋆ ↓

  • r

task 1 task 2

  • r

task 1 task 2 task 1 task 2

. . . Execution = sequence of executions of Q

6/15

slide-12
SLIDE 12

Non-deterministic Fork-Join programs (NFJ)

P, Q ::= P ∥ Q (parallel composition) | P; Q (sequential composition) | P + Q (non-deterministic choice) | P⋆ (loop) | a (atomic action) | (empty program)

7/15

slide-13
SLIDE 13

Combinatorial interpretation

Defjne the executions of P as a combinatorial class P: 0 = E a = Z P Q P Q P Q P Q P Q P Q

!

P SEQ P

!

P Q P Q P SEQ P Labelled and unlabelled operators in the same grammar;

!

P Q might contain the empty execution; P non-empty executions of P.

8/15

slide-14
SLIDE 14

Combinatorial interpretation

Defjne the executions of P as a combinatorial class P: 0 = E a = Z P; Q = P × Q

  • P ∥ Q = P ⋆ Q
  • P

Q P Q

!

P SEQ P

!

P Q P Q P SEQ P

  • Labelled and

unlabelled operators in the same grammar;

!

P Q might contain the empty execution; P non-empty executions of P.

8/15

slide-15
SLIDE 15

Combinatorial interpretation

Defjne the executions of P as a combinatorial class P: 0 = E a = Z P; Q = P × Q

  • P ∥ Q = P ⋆ Q
  • P + Q = P + Q

!

P SEQ P

!

P Q P Q P SEQ P

  • Labelled and

unlabelled operators in the same grammar;

!

P Q might contain the empty execution; P non-empty executions of P.

8/15

slide-16
SLIDE 16

Combinatorial interpretation

Defjne the executions of P as a combinatorial class P: 0 = E a = Z P; Q = P × Q

  • P ∥ Q = P ⋆ Q
  • P + Q = P + Q

!

P⋆ = SEQ (P)

!

P Q P Q P SEQ P

  • Labelled and

unlabelled operators in the same grammar;

!

P Q might contain the empty execution; P non-empty executions of P.

8/15

slide-17
SLIDE 17

Combinatorial interpretation

Defjne the executions of P as a combinatorial class P: 0 = E a = Z P; Q = P × Q

  • P ∥ Q = P ⋆ Q
  • P + Q = P + Q

!

P⋆ = SEQ (P)

!

P Q P Q P SEQ P

  • Labelled and

unlabelled operators in the same grammar;

!

P, Q might contain the empty execution; P non-empty executions of P.

8/15

slide-18
SLIDE 18

Combinatorial interpretation

Defjne the executions of P as a combinatorial class P: 0 = E a = Z P; Q = P × Q

  • P ∥ Q = P ⋆ Q
  • P + Q = P + Q

!

P⋆ = SEQ (P)

!

P + Q̸=0 = P̸=0 + Q̸=0

  • P⋆ = SEQ (P̸=0)
  • Labelled and

unlabelled operators in the same grammar;

!

P, Q might contain the empty execution;

  • P̸=0 = non-empty

executions of P.

8/15

slide-19
SLIDE 19

Outline

A class of concurrent programs Algorithmic aspects Conclusion and perspective

slide-20
SLIDE 20

Counting executions

Algorithm: P

  • prev. slide

− → P

symbolic method

− → GF

[zn]

− → count COUNT 0 1 COUNT a z COUNT P Q p z q z COUNT P Q p z q z COUNT P Q p z q z p 0 q 0 COUNT P 1 p z p 0

1

All operation are taken zn

1

p z COUNT P q z COUNT Q p z q z p z q z where

n an n zn n anzn and n anzn n an n zn 9/15

slide-21
SLIDE 21

Counting executions

Algorithm: P

  • prev. slide

− → P

symbolic method

− → GF

[zn]

− → count COUNT(0) = 1 COUNT(a) = z COUNT(P ∥ Q) = p(z) ⊚ q(z) COUNT(P; Q) = p(z) · q(z) COUNT(P + Q) = p(z) + q(z) − p(0)q(0) COUNT(P⋆) = (1 − (p(z) − p(0)))−1 All operation are taken mod zn+1 p(z) = COUNT(P) q(z) = COUNT(Q) p z q z p z q z where

n an n zn n anzn and n anzn n an n zn 9/15

slide-22
SLIDE 22

Counting executions

Algorithm: P

  • prev. slide

− → P

symbolic method

− → GF

[zn]

− → count COUNT(0) = 1 COUNT(a) = z COUNT(P ∥ Q) = p(z) ⊚ q(z) • COUNT(P; Q) = p(z) · q(z) COUNT(P + Q) = p(z) + q(z) − p(0)q(0) COUNT(P⋆) = (1 − (p(z) − p(0)))−1 All operation are taken mod zn+1 p(z) = COUNT(P) q(z) = COUNT(Q)

  • p(z) ⊚ q(z) = L (B (p(z)) · B (q(z)))

where L (∑

n an n! zn)

= ∑

n anzn and B (∑ n anzn) = ∑ n an n! zn 9/15

slide-23
SLIDE 23

Counting executions — complexity

Theorem The counting algorithm performs O(|P|M(n)) arithmetic

  • perations on big integers.

The coeffjcients of the polynomial have O(n ln n) bits.

  • |P| is the syntactic size of P.
  • M(n) is the cost of the multiplication of two polynomials
  • f degree n.

O P M n M n n bit-complexity.

10/15

slide-24
SLIDE 24

Counting executions — complexity

Theorem The counting algorithm performs O(|P|M(n)) arithmetic

  • perations on big integers.

The coeffjcients of the polynomial have O(n ln n) bits.

  • |P| is the syntactic size of P.
  • M(n) is the cost of the multiplication of two polynomials
  • f degree n.

= ⇒ O(|P|M(n)M(n ln n)) bit-complexity.

10/15

slide-25
SLIDE 25

Random sampling of executions

Algorithm: P

  • prev. slides

− → P recursive method − →

[FZC′93]

uniform execution Rule: 1 0

3

2 2

3 1

4 1

3 2

8 0

3 3

24 1 2 1 2 0 1 2 1 2 1 1 1 2 1 2 1 2 0 + 1 + 1 = 2

11/15

slide-26
SLIDE 26

Random sampling of executions

Algorithm: P

  • prev. slides

− → P recursive method − →

[FZC′93]

uniform execution SAMPLE((a + b)⋆ ∥ (c + (d; e) + (f; g)), 3) Rule: 1 0

3

2 2

3 1

4 1

3 2

8 0

3 3

24 1 2 1 2 0 1 2 1 2 1 1 1 2 1 2 1 2 0 + 1 + 1 = 2

11/15

slide-27
SLIDE 27

Random sampling of executions

Algorithm: P

  • prev. slides

− → P recursive method − →

[FZC′93]

uniform execution SAMPLE((a + b)⋆ ∥ (c + (d; e) + (f; g)), 3) Rule: Pn = Q0R0 (n ) + Q1Rn−1 (n

1

) + Q2Rn−2 (n

2

) + · · · Pick k ∈ 0; n with probability QkRn−k (n

k

) /Pn 1 · 0 · (3 ) + 2 · 2 · (3

1

) + 4 · 1 · (3

2

) + 8 · 0 · (3

3

) = 24 · (0 + 1/2 + 1/2 + 0) 0 1 2 1 2 1 1 1 2 1 2 1 2 0 + 1 + 1 = 2

11/15

slide-28
SLIDE 28

Random sampling of executions

Algorithm: P

  • prev. slides

− → P recursive method − →

[FZC′93]

uniform execution SHUFFLE(SAMPLE((a + b)⋆, 1), SAMPLE((c + (d; e) + (f; g)), 2)) Rule: 1 · 0 · (3 ) + 2 · 2 · (3

1

) + 4 · 1 · (3

2

) + 8 · 0 · (3

3

) = 24 · (0 + 1/2 + 1/2 + 0) 0 1 2 1 2 1 1 1 2 1 2 1 2 0 + 1 + 1 = 2

11/15

slide-29
SLIDE 29

Random sampling of executions

Algorithm: P

  • prev. slides

− → P recursive method − →

[FZC′93]

uniform execution SHUFFLE(SAMPLE((a + b)⋆, 1), . . .) Rule: P⋆ → 0 + P; P⋆ 1 · 0 · (3 ) + 2 · 2 · (3

1

) + 4 · 1 · (3

2

) + 8 · 0 · (3

3

) = 24 · (0 + 1/2 + 1/2 + 0) 0 1 2 1 2 1 1 1 2 1 2 1 2 0 + 1 + 1 = 2

11/15

slide-30
SLIDE 30

Random sampling of executions

Algorithm: P

  • prev. slides

− → P recursive method − →

[FZC′93]

uniform execution SHUFFLE(SAMPLE(0 + (a + b); (a + b)⋆, 1), . . .) Rule: P⋆ → 0 + P; P⋆ 1 · 0 · (3 ) + 2 · 2 · (3

1

) + 4 · 1 · (3

2

) + 8 · 0 · (3

3

) = 24 · (0 + 1/2 + 1/2 + 0) 0 1 2 1 2 1 1 1 2 1 2 1 2 0 + 1 + 1 = 2

11/15

slide-31
SLIDE 31

Random sampling of executions

Algorithm: P

  • prev. slides

− → P recursive method − →

[FZC′93]

uniform execution SHUFFLE(SAMPLE((a + b); (a + b)⋆, 1), . . .) Rule: 1 · 0 · (3 ) + 2 · 2 · (3

1

) + 4 · 1 · (3

2

) + 8 · 0 · (3

3

) = 24 · (0 + 1/2 + 1/2 + 0) 0 1 2 1 2 1 1 1 2 1 2 1 2 0 + 1 + 1 = 2

11/15

slide-32
SLIDE 32

Random sampling of executions

Algorithm: P

  • prev. slides

− → P recursive method − →

[FZC′93]

uniform execution SHUFFLE(SAMPLE((a + b); (a + b)⋆, 1), . . .) Rule: Pn = Q0R0 + Q1Rn−1 + Q2Rn−2 + · · · Pick k ∈ 0; n with probability QkRn−k/Pn 1 · 0 · (3 ) + 2 · 2 · (3

1

) + 4 · 1 · (3

2

) + 8 · 0 · (3

3

) = 24 · (0 + 1/2 + 1/2 + 0) 0 · 1 + 2 · 1 = 2 · (0 + 1) 1 1 2 1 2 1 2 0 + 1 + 1 = 2

11/15

slide-33
SLIDE 33

Random sampling of executions

Algorithm: P

  • prev. slides

− → P recursive method − →

[FZC′93]

uniform execution SHUFFLE(SAMPLE(a + b, 1), . . .) Rule: 1 · 0 · (3 ) + 2 · 2 · (3

1

) + 4 · 1 · (3

2

) + 8 · 0 · (3

3

) = 24 · (0 + 1/2 + 1/2 + 0) 0 · 1 + 2 · 1 = 2 · (0 + 1) 1 1 2 1 2 1 2 0 + 1 + 1 = 2

11/15

slide-34
SLIDE 34

Random sampling of executions

Algorithm: P

  • prev. slides

− → P recursive method − →

[FZC′93]

uniform execution SHUFFLE(SAMPLE(a + b, 1), . . .) Rule: Pn = Qn + Rn Choose Q with probability Qn/Pn 1 · 0 · (3 ) + 2 · 2 · (3

1

) + 4 · 1 · (3

2

) + 8 · 0 · (3

3

) = 24 · (0 + 1/2 + 1/2 + 0) 0 · 1 + 2 · 1 = 2 · (0 + 1) 1 + 1 = 2 · (1/2 + 1/2) 0 + 1 + 1 = 2

11/15

slide-35
SLIDE 35

Random sampling of executions

Algorithm: P

  • prev. slides

− → P recursive method − →

[FZC′93]

uniform execution SHUFFLE(a, . . .) Rule: 1 · 0 · (3 ) + 2 · 2 · (3

1

) + 4 · 1 · (3

2

) + 8 · 0 · (3

3

) = 24 · (0 + 1/2 + 1/2 + 0) 0 · 1 + 2 · 1 = 2 · (0 + 1) 1 + 1 = 2 · (1/2 + 1/2) 0 + 1 + 1 = 2

11/15

slide-36
SLIDE 36

Random sampling of executions

Algorithm: P

  • prev. slides

− → P recursive method − →

[FZC′93]

uniform execution SHUFFLE(a, SAMPLE((c + (d; e) + (f; g)), 2)) Rule: 1 · 0 · (3 ) + 2 · 2 · (3

1

) + 4 · 1 · (3

2

) + 8 · 0 · (3

3

) = 24 · (0 + 1/2 + 1/2 + 0) 0 · 1 + 2 · 1 = 2 · (0 + 1) 1 + 1 = 2 · (1/2 + 1/2) 0 + 1 + 1 = 2

11/15

slide-37
SLIDE 37

Random sampling of executions

Algorithm: P

  • prev. slides

− → P recursive method − →

[FZC′93]

uniform execution SHUFFLE(a, SAMPLE((c + (d; e) + (f; g)), 2)) Rule: Pn = Qn + Rn + Sn Choose Q (or R) with probability Qn/Pn (or Rn/Pn) 1 · 0 · (3 ) + 2 · 2 · (3

1

) + 4 · 1 · (3

2

) + 8 · 0 · (3

3

) = 24 · (0 + 1/2 + 1/2 + 0) 0 · 1 + 2 · 1 = 2 · (0 + 1) 1 + 1 = 2 · (1/2 + 1/2) 0 + 1 + 1 = 2

11/15

slide-38
SLIDE 38

Random sampling of executions

Algorithm: P

  • prev. slides

− → P recursive method − →

[FZC′93]

uniform execution SHUFFLE(a, SAMPLE((d; e), 2)) Rule: 1 · 0 · (3 ) + 2 · 2 · (3

1

) + 4 · 1 · (3

2

) + 8 · 0 · (3

3

) = 24 · (0 + 1/2 + 1/2 + 0) 0 · 1 + 2 · 1 = 2 · (0 + 1) 1 + 1 = 2 · (1/2 + 1/2) 0 + 1 + 1 = 2

11/15

slide-39
SLIDE 39

Random sampling of executions

Algorithm: P

  • prev. slides

− → P recursive method − →

[FZC′93]

uniform execution SHUFFLE(a, de) Rule: 1 · 0 · (3 ) + 2 · 2 · (3

1

) + 4 · 1 · (3

2

) + 8 · 0 · (3

3

) = 24 · (0 + 1/2 + 1/2 + 0) 0 · 1 + 2 · 1 = 2 · (0 + 1) 1 + 1 = 2 · (1/2 + 1/2) 0 + 1 + 1 = 2

11/15

slide-40
SLIDE 40

Random sampling of executions

Algorithm: P

  • prev. slides

− → P recursive method − →

[FZC′93]

uniform execution dae Rule: 1 · 0 · (3 ) + 2 · 2 · (3

1

) + 4 · 1 · (3

2

) + 8 · 0 · (3

3

) = 24 · (0 + 1/2 + 1/2 + 0) 0 · 1 + 2 · 1 = 2 · (0 + 1) 1 + 1 = 2 · (1/2 + 1/2) 0 + 1 + 1 = 2

11/15

slide-41
SLIDE 41

Random sampling of executions

Pn = Q0Rn + Q1Rn−1 + Q2Rn−2 + · · · + QnR0 How to draw k ∈ 0; n with probability QkRn−k/Pn? Solution 1: Draw x UNIF 0 Pn and take the minimum k such that x Q0Rn Q1Rn

1

QkRn

k.

Solution 2 (boustrophedonic alg., [FZC’93,Molinero’05]): Draw x UNIF 0 Pn and take the minimum k such that x Q0Rn QnR0 Q1Rn

1

Qn

1R1

Q2Rn

2

k terms .

12/15

slide-42
SLIDE 42

Random sampling of executions

Pn = Q0Rn + Q1Rn−1 + Q2Rn−2 + · · · + QnR0 How to draw k ∈ 0; n with probability QkRn−k/Pn? Solution 1: Draw x ∼ UNIF(0; Pn) and take the minimum k such that x < Q0Rn + Q1Rn−1 + · · · + QkRn−k. Solution 2 (boustrophedonic alg., [FZC’93,Molinero’05]): Draw x UNIF 0 Pn and take the minimum k such that x Q0Rn QnR0 Q1Rn

1

Qn

1R1

Q2Rn

2

k terms .

12/15

slide-43
SLIDE 43

Random sampling of executions

Pn = Q0Rn + Q1Rn−1 + Q2Rn−2 + · · · + QnR0 How to draw k ∈ 0; n with probability QkRn−k/Pn? Solution 1: Draw x ∼ UNIF(0; Pn) and take the minimum k such that x < Q0Rn + Q1Rn−1 + · · · + QkRn−k. Solution 2 (boustrophedonic alg., [FZC’93,Molinero’05]): Draw x ∼ UNIF(0; Pn) and take the minimum k such that x < Q0Rn + QnR0 + Q1Rn−1 + Qn−1R1 + Q2Rn−2 + . . . (k terms).

12/15

slide-44
SLIDE 44

Random sampling of executions — complexity

Theorem [FZC’93,Molinero’05] The recursive method with solution 2 has complexity O(n ln n). Theorem [Molinero’05] The recursive method has complexity O(n) on recursion-free specifjcations.

!

The constant hidden in the O depends on the specifj- cation!

13/15

slide-45
SLIDE 45

Random sampling of executions — complexity

Theorem [FZC’93,Molinero’05] The recursive method with solution 2 has complexity O(n ln n). Theorem [Molinero’05] The recursive method has complexity O(n) on recursion-free specifjcations.

!

The constant hidden in the O depends on the specifj- cation!

13/15

slide-46
SLIDE 46

Random sampling of executions — complexity

Theorem [FZC’93,Molinero’05] The recursive method with solution 2 has complexity O(n ln n). Theorem (updated) The recursive method has complexity O(h · n) on recursion-free specifjcation, where h is the number of nested

  • perators of the spec.

!

The constant hidden in the O depends on the specifj- cation!

13/15

slide-47
SLIDE 47

Random sampling of executions — complexity

Theorem Random sampling of executions has complexity O(n · min(h(P), ln n)) where h denotes the “height”

  • f P i.e. its maximum number of nested constructors.

14/15

slide-48
SLIDE 48

Outline

A class of concurrent programs Algorithmic aspects Conclusion and perspective

slide-49
SLIDE 49

Conclusion

Take away:

  • Specifjcations can be used as fjrst-class objects

Future work:

  • Generalize the model
  • Analytic properties of the OGF of P ?
  • Statistical model-checking

15/15

slide-50
SLIDE 50

Conclusion

Take away:

  • Specifjcations can be used as fjrst-class objects

Future work:

  • Generalize the model
  • Analytic properties of the OGF of P?
  • Statistical model-checking

15/15

slide-51
SLIDE 51

Thanks for your attention