On Probabilistic Parallel Programs with Process Creation and - - PowerPoint PPT Presentation

on probabilistic parallel programs with process creation
SMART_READER_LITE
LIVE PREVIEW

On Probabilistic Parallel Programs with Process Creation and - - PowerPoint PPT Presentation

On Probabilistic Parallel Programs with Process Creation and Synchronisation Stefan Kiefer 1 Dominik Wojtczak 1 , 2 1 University of Oxford, UK 2 University of Liverpool, UK TACAS, Saarbrcken 30 March 2011 Stefan Kiefer, Dominik Wojtczak On


slide-1
SLIDE 1

On Probabilistic Parallel Programs with Process Creation and Synchronisation

Stefan Kiefer1 Dominik Wojtczak1,2

1University of Oxford, UK 2University of Liverpool, UK

TACAS, Saarbrücken 30 March 2011

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-2
SLIDE 2

Split-Join Systems: A Model for Programs with Process Spawning

The rules of a SJS: split: X ֒ − → XX intern: X ֒ − → q intern: X ֒ − → r join: qr ֒ − → X An example run: X

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-3
SLIDE 3

Split-Join Systems: A Model for Programs with Process Spawning

The rules of a SJS: split: X ֒ − → XX intern: X ֒ − → q intern: X ֒ − → r join: qr ֒ − → X An example run: X X X

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-4
SLIDE 4

Split-Join Systems: A Model for Programs with Process Spawning

The rules of a SJS: split: X ֒ − → XX intern: X ֒ − → q intern: X ֒ − → r join: qr ֒ − → X An example run: X X X q r

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-5
SLIDE 5

Split-Join Systems: A Model for Programs with Process Spawning

The rules of a SJS: split: X ֒ − → XX intern: X ֒ − → q intern: X ֒ − → r join: qr ֒ − → X An example run: X X X q r

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-6
SLIDE 6

Split-Join Systems: A Model for Programs with Process Spawning

The rules of a SJS: split: X ֒ − → XX intern: X ֒ − → q intern: X ֒ − → r join: qr ֒ − → X An example run: X X X q r X

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-7
SLIDE 7

Split-Join Systems: A Model for Programs with Process Spawning

The rules of a SJS: split: X ֒ − → XX intern: X ֒ − → q intern: X ֒ − → r join: qr ֒ − → X An example run: X X X q r X q

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-8
SLIDE 8

Split-Join Systems: A Model for Programs with Process Spawning

The rules of a SJS: split: X ֒ − → XX intern: X ֒ − → q intern: X ֒ − → r join: qr ֒ − → X An example run: X X X q r X q Synchronisation states (here q, r) can be used to return values.

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-9
SLIDE 9

Split-Join Systems: A Model for Programs with Process Spawning

The rules of a SJS: split: X ֒ − → XX intern: X ֒ − → q intern: X ֒ − → r join: qr ֒ − → X An example run: X X X q r X q Synchronisation states (here q, r) can be used to return values. Associated to a run: Time T = 4, Work W = 5, Space S = 2

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-10
SLIDE 10

Split-Join Systems: A Model for Programs with Process Spawning

The rules of a pSJS: split: X

0.5

֒ − → XX intern: X

0.3

֒ − → q intern: X

0.2

֒ − → r join: qr

1.0

֒ − → X An example run: X X X q r X q Synchronisation states (here q, r) can be used to return values. Associated to a run: Time T = 4, Work W = 5, Space S = 2

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-11
SLIDE 11

Split-Join Systems: A Model for Programs with Process Spawning

The rules of a pSJS: split: X

0.5

֒ − → XX intern: X

0.3

֒ − → q intern: X

0.2

֒ − → r join: qr

1.0

֒ − → X Another example run: X

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-12
SLIDE 12

Split-Join Systems: A Model for Programs with Process Spawning

The rules of a pSJS: split: X

0.5

֒ − → XX intern: X

0.3

֒ − → q intern: X

0.2

֒ − → r join: qr

1.0

֒ − → X Another example run: X X X

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-13
SLIDE 13

Split-Join Systems: A Model for Programs with Process Spawning

The rules of a pSJS: split: X

0.5

֒ − → XX intern: X

0.3

֒ − → q intern: X

0.2

֒ − → r join: qr

1.0

֒ − → X Another example run: X X X q X X

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-14
SLIDE 14

Split-Join Systems: A Model for Programs with Process Spawning

The rules of a pSJS: split: X

0.5

֒ − → XX intern: X

0.3

֒ − → q intern: X

0.2

֒ − → r join: qr

1.0

֒ − → X Another example run: X X X q X X r q

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-15
SLIDE 15

Split-Join Systems: A Model for Programs with Process Spawning

The rules of a pSJS: split: X

0.5

֒ − → XX intern: X

0.3

֒ − → q intern: X

0.2

֒ − → r join: qr

1.0

֒ − → X Another example run: X X X q X X r q Time T = 3, Work W = 5, Space S = 3

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-16
SLIDE 16

Why the Sibling Constraint?

The sibling constraint prevents arbitrary synchronisation. Arbitrary Synchronisation would lead to Petri-Nets. more difficult to analyse Sibling Synchronisation is enough for modeling purposes.

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-17
SLIDE 17

Relationship to pPDSs

pSJSs subsume (probabilistic) pushdown systems (pPDSs). Pushdown rules: push: qX ֒ − → rYZ intern: rY ֒ − → sW pop: sW ֒ − → t pop: tZ ֒ − → u Run qX ⇒ rYZ ⇒ sWZ ⇒ tZ ⇒ u

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-18
SLIDE 18

Relationship to pPDSs

pSJSs subsume (probabilistic) pushdown systems (pPDSs). Pushdown rules: push: qX ֒ − → rYZ intern: rY ֒ − → sW pop: sW ֒ − → t pop: tZ ֒ − → u Run qX ⇒ rYZ ⇒ sWZ ⇒ tZ ⇒ u View this run as: qX qX

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-19
SLIDE 19

Relationship to pPDSs

pSJSs subsume (probabilistic) pushdown systems (pPDSs). Pushdown rules: push: qX ֒ − → rYZ intern: rY ֒ − → sW pop: sW ֒ − → t pop: tZ ֒ − → u Run qX ⇒ rYZ ⇒ sWZ ⇒ tZ ⇒ u View this run as: qX rY rY Z

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-20
SLIDE 20

Relationship to pPDSs

pSJSs subsume (probabilistic) pushdown systems (pPDSs). Pushdown rules: push: qX ֒ − → rYZ intern: rY ֒ − → sW pop: sW ֒ − → t pop: tZ ֒ − → u Run qX ⇒ rYZ ⇒ sWZ ⇒ tZ ⇒ u View this run as: qX rY Z sW sW

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-21
SLIDE 21

Relationship to pPDSs

pSJSs subsume (probabilistic) pushdown systems (pPDSs). Pushdown rules: push: qX ֒ − → rYZ intern: rY ֒ − → sW pop: sW ֒ − → t pop: tZ ֒ − → u Run qX ⇒ rYZ ⇒ sWZ ⇒ tZ ⇒ u View this run as: qX rY Z sW t

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-22
SLIDE 22

Relationship to pPDSs

pSJSs subsume (probabilistic) pushdown systems (pPDSs). Pushdown rules: push: qX ֒ − → rYZ intern: rY ֒ − → sW pop: sW ֒ − → t pop: tZ ֒ − → u Run qX ⇒ rYZ ⇒ sWZ ⇒ tZ ⇒ u View this run as: qX rY Z sW t

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-23
SLIDE 23

Relationship to pPDSs

pSJSs subsume (probabilistic) pushdown systems (pPDSs). Pushdown rules: push: qX ֒ − → rYZ intern: rY ֒ − → sW pop: sW ֒ − → t pop: tZ ֒ − → u Run qX ⇒ rYZ ⇒ sWZ ⇒ tZ ⇒ u View this run as: qX rY Z sW t u

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-24
SLIDE 24

Relationship to pPDSs

pSJSs subsume (probabilistic) pushdown systems (pPDSs). Pushdown rules: push: qX ֒ − → rYZ intern: rY ֒ − → sW pop: sW ֒ − → t pop: tZ ֒ − → u Run qX ⇒ rYZ ⇒ sWZ ⇒ tZ ⇒ u View this run as: qX rY Z sW t u Time T = 4, Work W = T = 4, Space S = 2

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-25
SLIDE 25

Relationship to pPDSs

Conversely, any pSJS can be sequentialised. The resulting pPDS is equivalent with respect to returned value work

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-26
SLIDE 26

Relationship to pPDSs

Conversely, any pSJS can be sequentialised. The resulting pPDS is equivalent with respect to returned value work Bottomline: pPDSs: sequential programs pSJSs: parallel programs

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-27
SLIDE 27

Relationship to Branching Processes

A branching process is a pSJS without join rules. Example X

0.5

֒ − → XY Y

0.3

֒ − → X X

0.5

֒ − → q Y

0.7

֒ − → q A single synchronisation state suffices. classical mathematical model biology, physics, natural language processing, . . .

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-28
SLIDE 28

pSJSs are general.

Our pSJS model generalises pPDSs and branching process. procedures from pPDSs

may be recursive may return values

parallel spawns from branching processes new: joins for process synchronisation and communication

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-29
SLIDE 29

Termination

split: X

0.5

֒ − → XX intern: X

0.3

֒ − → q intern: X

0.2

֒ − → r join: qr

1.0

֒ − → X terminating runs: X X X q X X r q X X X q r X q One can transform the pSJS so that all terminating runs terminate in a single state.

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-30
SLIDE 30

Termination Probability

[X↓q] = Prob. that X terminates in q Example X

2/3

֒ − − → XX X

1/3

֒ − − → q qq

1

֒ − → q X can only terminate in q. We have [X↓q] = 1/2. Theorem The [X↓q] are the solution of a system of polynomial equations. Deciding whether [X↓q] = 0 is in P. Deciding whether [X↓q] < 1 is PosSLP-hard even for pPDSs.

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-31
SLIDE 31

Probability of Finite Space

A pSJS may be useful even if it does not always terminate.

  • perating systems, network servers, system daemons, . . .

Theorem Let r be the probability that a computation started in X needs only finite space. Then r can be “efficiently expressed”. Deciding whether r = 0 is in P. Deciding whether r < 1 is PosSLP-hard even for pPDSs. Proof: By transforming the pSJS so that a run terminates if and only if it needs finite space. Applied to pPDSs, the theorem improves on [EKM05].

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-32
SLIDE 32

Work and Time

Given a pSJS and a start process X, one can compute P(W = k) and P(T = k) for k = 1, 2, . . . iteratively. This allows to approximate EW and ET.

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-33
SLIDE 33

Work and Time

Given a pSJS and a start process X, one can compute P(W = k) and P(T = k) for k = 1, 2, . . . iteratively. This allows to approximate EW and ET. Theorem EW and ET are either both finite or both infinite. Distinguishing between those cases is in PSPACE and PosSLP-hard even for pPDSs.

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-34
SLIDE 34

Work and Time

Given a pSJS and a start process X, one can compute P(W = k) and P(T = k) for k = 1, 2, . . . iteratively. This allows to approximate EW and ET. Theorem EW and ET are either both finite or both infinite. Distinguishing between those cases is in PSPACE and PosSLP-hard even for pPDSs. Proof sketch for the upper bound: transform the pSJS to a branching process with similar distribution of W and T (uses [X↓q]) set up a matrix A for the branching process such that AX,Y = expected number of spawned Y-processes when applying an X-rule compute the spectral radius of A and compare with 1

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-35
SLIDE 35

Example of a Performance Analysis: Game Tree Evaluation

We wish to analyse programs that evaluate min-max trees: ∨ 3 ∧ 3 ∧ ≤3 ∧ ≤2 ∨ 3 ∨ ≥3 ∨ ≥4 ∨ 3 ∨ ∨ ∨ 2 ∨ ∨ 3 2 2 3 4 3 3 1 2 1 1

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-36
SLIDE 36

Example of a Performance Analysis: Game Tree Evaluation

We wish to analyse programs that evaluate min-max trees: ∨ 3 ∧ 3 ∧ ≤3 ∧ ≤2 ∨ 3 ∨ ≥3 ∨ ≥4 ∨ 3 ∨ ∨ ∨ 2 ∨ ∨ 3 2 2 3 4 3 3 1 2 1 1 (assume 0 or 3 children per node)

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-37
SLIDE 37

A Straightforward Parallel Program

function parMax(node) if node.leaf() then return node.val() else parallel val1 := parMin(node.c1), val2 := parMin(node.c2), val3 := parMin(node.c3) return max{val1, val2, val3}

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-38
SLIDE 38

A Straightforward Parallel Program

function parMax(node) if node.leaf() then return node.val() else parallel val1 := parMin(node.c1), val2 := parMin(node.c2), val3 := parMin(node.c3) return max{val1, val2, val3} parallel, but a lot of unnecessary work (maybe deep in the tree)

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-39
SLIDE 39

Example of a Performance Analysis: Game Tree Evaluation

We wish to analyse programs that evaluate min-max trees: ∨ 3 ∧ 3 ∧ ≤3 ∧ ≤2 ∨ 3 ∨ ≥3 ∨ ≥4 ∨ 3 ∨ ∨ ∨ 2 ∨ ∨ 3 2 2 3 4 3 3 1 2 1 1

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-40
SLIDE 40

A Smart Sequential Program

function seqMax(node, α, β) (initially: α = −∞, β = +∞) if node.leaf() then if node.val() ≤ α then return α elsif node.val() ≥ β then return β else return node.val() else val1 := seqMin(node.c1, α, β) if val1 = β then return β

(*cut-off after 1st child*)

else val2 := seqMin(node.c2, val1, β) if val2 = β then return β

(*cut-off after 2nd child*)

else return seqMin(node.c3, val2, β)

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-41
SLIDE 41

A Smart Sequential Program

function seqMax(node, α, β) (initially: α = −∞, β = +∞) if node.leaf() then if node.val() ≤ α then return α elsif node.val() ≥ β then return β else return node.val() else val1 := seqMin(node.c1, α, β) if val1 = β then return β

(*cut-off after 1st child*)

else val2 := seqMin(node.c2, val1, β) if val2 = β then return β

(*cut-off after 2nd child*)

else return seqMin(node.c3, val2, β) no unnecessary work, but sequential

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-42
SLIDE 42

A Smart Parallel Program

“Young Brothers Wait”: Idea: cut-offs usually occur after the 1st child (“oldest brother”) do the oldest brother

  • nly if no cut-off: do the young brothers in parallel

function YBWMax(node, α, β) if node.leaf() then if node.val() ≤ α then return α elsif node.val() ≥ β then return β else return node.val() else val1 := YBWMin(node.c1, α, β) if val1 = β then return β

(*cut-off after 1st child*)

else parallel val2 := YBWMin(node.c2, val1, β), val3 := YBWMin(node.c3, val1, β) return max{val2, val3}

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-43
SLIDE 43

Performance Analysis

These programs (par, seq, YBW) have various features: procedural recursive return values spawns and joins

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-44
SLIDE 44

Performance Analysis

These programs (par, seq, YBW) have various features: procedural recursive return values spawns and joins probabilistic if the input (the trees) are probabilistic

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-45
SLIDE 45

Performance Analysis

These programs (par, seq, YBW) have various features: procedural recursive return values spawns and joins probabilistic if the input (the trees) are probabilistic This all fits naturally in the pSJS model. We analyse performance under prob. assumptions on the input.

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-46
SLIDE 46

Performance Analysis

Expected runtime of par and YBW compared to seq, as a function of p (p controls the expected tree size) p 0.05 0.10 0.15 0.20 0.25 0.30 +10% +20% +30% +40% +50% −10% ±0% par YBW

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-47
SLIDE 47

Conclusions

pSJS: new model for probabilistic parallel programs with process spawning and synchronisation Basic quantitative analysis is as expensive as for pPDSs. We can model, analyse and compare parallel programs under probabilistic assumptions.

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation

slide-48
SLIDE 48

End of Talk

Thank you!

Stefan Kiefer, Dominik Wojtczak On Probabilistic Parallel Programs with Process Creation