translating orc features into petri nets and the join calculus hernán melgratti imt lucca institute...

44
Translating Orc Features into Petri Nets and the Join Calculus Hernán Melgratti IMT Lucca Institute for Advance Studies Joint Work with Roberto Bruni and Emilio Tuosto

Post on 21-Dec-2015

215 views

Category:

Documents


1 download

TRANSCRIPT

Translating Orc Features into Petri Nets and the Join Calculus

Hernán MelgrattiIMT Lucca Institute for Advance Studies

Joint Work with

Roberto Bruni and Emilio Tuosto

WS-FM 2006 Hernán Melgratti@IMTLucca-

Aims

To distill Orc primitives Orc is an orchestration language

•It is a process calculus

•It does not provide any explicit mechanism for name creation

WS-FM 2006 Hernán Melgratti@IMTLucca-

Roadmap

Is it an Orc process an ordinary Petri net?

Place / transition Petri nets are not enough•The need of distinguishing different

evaluations of the same expression

•The need of killing executions So, we encode Orc into the Join

calculus

WS-FM 2006 Hernán Melgratti@IMTLucca-

Orc in one slide Basic services or sites: M,M1,M2,…

•Providing functionalities Site call: M(p0,…,pn)

•Return at most one result Pipeline: f>x>g

•Sequential composition (x occurs bound in g) Symmetric Parallelism: f|g

• Independent computation Asymmetric Parallelism: g where x:f

•x occurs bound in f Recussion: E(q0,…,qn) f, and E occurs

in f

WS-FM 2006 Hernán Melgratti@IMTLucca-

Orc by example [KCM06]

CNN and BBC are news services CNN(d)

•It may return 0 or 1 value CNN(d) | BBC(d)

•May produce 0, 1, or 2 values (CNN(d) | BBC(d)) > x > email(a,x)

•email may be called 0, 1, or 2 times email(a,x) where x:(CNN(d)| BBC(d))

•email is called at most one

WS-FM 2006 Hernán Melgratti@IMTLucca-

Orc into Petri Nets

1-answer 0-answer

call

return

Site invocation

WS-FM 2006 Hernán Melgratti@IMTLucca-

Orc into Petri Nets

1-answer 0-answer

call

return

Site invocation f > x > g

WS-FM 2006 Hernán Melgratti@IMTLucca-

Orc into Petri Nets

1-answer 0-answer

call

return

Site invocation

f

g

f > x > g

WS-FM 2006 Hernán Melgratti@IMTLucca-

Orc into Petri Nets

1-answer 0-answer

call

return

Site invocation

Actually we need coloured

tokensx

x

f

g

f > x > g

WS-FM 2006 Hernán Melgratti@IMTLucca-

Orc into Petri Nets

1-answer 0-answer

call

return

Site invocation

f

g

f | g f > x > g

WS-FM 2006 Hernán Melgratti@IMTLucca-

Orc into Petri Nets

1-answer 0-answer

call

return

Site invocation

f

g

f g

f > x > g f | g

WS-FM 2006 Hernán Melgratti@IMTLucca-

Orc into Petri Nets

1-answer 0-answer

call

return

Site invocation

f

g

f g

f > x > g f | g

WS-FM 2006 Hernán Melgratti@IMTLucca-

Orc into Petri Nets

1-answer 0-answer

call

return

Site invocation

f

g

f g

f > x > g f | g

WS-FM 2006 Hernán Melgratti@IMTLucca-

An Orc Process as a PN

(CNN(d) | BBC(d))> x > email(a,x)

WS-FM 2006 Hernán Melgratti@IMTLucca-

An Orc Process as a PN

1-answer 0-answer 1-answer 0-answer

Call_CNN Call_BBC

(CNN(d) | BBC(d))> x > email(a,x)

WS-FM 2006 Hernán Melgratti@IMTLucca-

An Orc Process as a PN

1-answer 0-answer

Return_CNN

1-answer 0-answer

Call_CNN Call_BBC

Return_BBC

(CNN(d) | BBC(d))> x > email(a,x)

WS-FM 2006 Hernán Melgratti@IMTLucca-

An Orc Process as a PN

1-answer 0-answer

Return_CNN

1-answer 0-answer

Call_CNN Call_BBC

Return_BBC

(CNN(d) | BBC(d))> x > email(a,x)

1-answer 0-answer

Return_Email

Call_Email

WS-FM 2006 Hernán Melgratti@IMTLucca-

Mapping the Asym. composition

f where x: g

f g

WS-FM 2006 Hernán Melgratti@IMTLucca-

Mapping the Asym. composition

f where x: g

f g

WS-FM 2006 Hernán Melgratti@IMTLucca-

Mapping the Asym. composition

f where x: g

f g

WS-FM 2006 Hernán Melgratti@IMTLucca-

Mapping the Asym. composition

email(a,x) where x:(CNN(d)| BBC(d))

WS-FM 2006 Hernán Melgratti@IMTLucca-

Mapping the Asym. composition

Return_BBC

email(a,x) where x:(CNN(d)| BBC(d))

1-answer 0-answer

Return_CNN

1-answer 0-answer

Call_CNN Call_BBC1-answer 0-answer

Return_Email

Call_Email

WS-FM 2006 Hernán Melgratti@IMTLucca-

Mapping the Asym. composition

Return_BBC

email(a,x) where x:(CNN(d)| BBC(d))

1-answer 0-answer

Return_CNN

1-answer 0-answer

Call_CNN Call_BBC1-answer 0-answer

Return_Email

Call_Email

WS-FM 2006 Hernán Melgratti@IMTLucca-

Mapping the Asym. composition

Return_BBC

email(a,x) where x:(CNN(d)| BBC(d))

1-answer 0-answer

Return_CNN

1-answer 0-answer

Call_CNN Call_BBC1-answer 0-answer

Return_Email

Call_Email

WS-FM 2006 Hernán Melgratti@IMTLucca-

Mapping the Asym. composition

Return_BBC

email(a,x) where x:(CNN(d)| BBC(d))

1-answer 0-answer

Return_CNN

1-answer 0-answer

Call_CNN Call_BBC1-answer 0-answer

Return_Email

Call_Email

lock

WS-FM 2006 Hernán Melgratti@IMTLucca-

But it doesn’t work

email(a,x) where x:(CNN(d)| BBC(d))f > d >

WS-FM 2006 Hernán Melgratti@IMTLucca-

But it doesn’t work

Return_BBC

email(a,x) where x:(CNN(d)| BBC(d))

1-answer 0-answer

Return_CNN

1-answer 0-answer

Call_CNN Call_BBC1-answer 0-answer

Return_Email

Call_Email

f > d >

lock

WS-FM 2006 Hernán Melgratti@IMTLucca-

But it doesn’t work

Return_BBC

email(a,x) where x:(CNN(d)| BBC(d))

1-answer 0-answer

Return_CNN

1-answer 0-answer

Call_CNN Call_BBC1-answer 0-answer

Return_Email

Call_Email

f > d >

lock

WS-FM 2006 Hernán Melgratti@IMTLucca-

But it doesn’t work

Return_BBC

email(a,x) where x:(CNN(d)| BBC(d))

1-answer 0-answer

Return_CNN

1-answer 0-answer

Call_CNN Call_BBC1-answer 0-answer

Return_Email

Call_Email

f > d >

lock

WS-FM 2006 Hernán Melgratti@IMTLucca-

But it doesn’t work

Return_BBC

email(a,x) where x:(CNN(d)| BBC(d))

1-answer 0-answer

Return_CNN

1-answer 0-answer

Call_CNN Call_BBC1-answer 0-answer

Return_Email

Call_Email

f > d >

lock

WS-FM 2006 Hernán Melgratti@IMTLucca-

But it doesn’t work

Return_BBC

email(a,x) where x:(CNN(d)| BBC(d))

1-answer 0-answer

Return_CNN

1-answer 0-answer

Call_CNN Call_BBC1-answer 0-answer

Return_Email

Call_Email

f > d >

lock

WS-FM 2006 Hernán Melgratti@IMTLucca-

But it doesn’t work

Return_BBC

email(a,x) where x:(CNN(d)| BBC(d))

1-answer 0-answer

Return_CNN

1-answer 0-answer

Call_CNN Call_BBC1-answer 0-answer

Return_Email

Call_Email

f > d >

lock

WS-FM 2006 Hernán Melgratti@IMTLucca-

But it doesn’t work

Return_BBC

email(a,x) where x:(CNN(d)| BBC(d))

1-answer 0-answer

Return_CNN

1-answer 0-answer

Call_CNN Call_BBC1-answer 0-answer

Return_Email

Call_Email

f > d >

lock

•We should kill the running computation (i.e., remove tokens from the net). •This can be done by using inhibitor or reset arcs

•In any case we sequentialise several evaluations of the same expression

WS-FM 2006 Hernán Melgratti@IMTLucca-

Join

Join processes can be seen as dynamic and reconfigurable, coloured nets

WS-FM 2006 Hernán Melgratti@IMTLucca-

Join

Join processes can be seen as dynamic and reconfigurable, coloured netsa

x

b

x

ax xb

WS-FM 2006 Hernán Melgratti@IMTLucca-

Join

Join processes can be seen as dynamic and reconfigurable, coloured netsa

x

b

x

ax xb

ac

defin aa | ac

a

x

b

x

ax xb

b

def

in ab | cb

bc

a

x

b

x

ax xb

a

defin aa | cb

bc

WS-FM 2006 Hernán Melgratti@IMTLucca-

Join

Join processes can be seen as dynamic and reconfigurable, coloured netsa

x

ax def cy yx in cc

c

y

x

cy

WS-FM 2006 Hernán Melgratti@IMTLucca-

Join

Join processes can be seen as dynamic and reconfigurable, coloured netsa

x

ax def cy yx in cc

ab

def

c

y

x

cy

in aa | ab

a

x

ax def cy yx in cc

b

def

c

y

x

cy

in ab | cc

c yc

y

cy ay

WS-FM 2006 Hernán Melgratti@IMTLucca-

Orc into Join

f

w

g

z

Any evaluation of g is done on a fresh

copy of the net

wv {g}zdef

v

in {f}w

{ f > x > g }z

WS-FM 2006 Hernán Melgratti@IMTLucca-

Orc into Join

f

w

g

z

wv {g}zdef in {f}w

v

{ f | g }z

f g

z

{f}z | {g}z

f

w

v

g

v

valx

wv | tok valx def in {f}w | {g}z | tok

{ f where x: g }z{ f > x > g }z

WS-FM 2006 Hernán Melgratti@IMTLucca-

Orc into Join

Site invocation

{ CNN(d) }z

Using the continuation style

CNN(d,k)

kv zvdef in CNN(d,k)

We can receive more

than one answer for a

call

kv | tok zvdef in CNN(d,k) | tok

WS-FM 2006 Hernán Melgratti@IMTLucca-

We don’t get exactly the same behaviour

When x is chosen g is killed

After one x is chosen, all other value produced by g is ignored

After receiving one answer, the sender is blocked

Only one received answer is considered

CNN(d)

kv | tok zvdef in CNN(d,k) | tok

wv | tok valx def in {f}w | {g}z | tok

f where x: g

WS-FM 2006 Hernán Melgratti@IMTLucca-

Correspondence

Theorem: Let O be an Orc Program and {O} its encoding in Join. Then, O {O} when considering the non killing asymmetric composition.

WS-FM 2006 Hernán Melgratti@IMTLucca-

Final Remarks

The encoding highlights the fact that Orc primitives involve dynamic creation of names

Pruning of asymmetric composition is an operation not common in PC•Is it realistic in a distributed setting?

•This can be seen as equivalent to the disabling of input ports