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

Translating Orc Features into Petri Nets and the Join Calculus

  • Upload
    gurit

  • View
    30

  • Download
    0

Embed Size (px)

DESCRIPTION

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. Aims. To distill Orc primitives Orc is an orchestration language It is a process calculus - PowerPoint PPT Presentation

Citation preview

Page 1: Translating Orc Features into Petri Nets and the Join Calculus

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

Page 2: Translating Orc Features into Petri Nets and the Join Calculus

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

Page 3: Translating Orc Features into Petri Nets and the Join Calculus

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

Page 4: Translating Orc Features into Petri Nets and 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

Page 5: Translating Orc Features into Petri Nets and the Join Calculus

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

Page 6: Translating Orc Features into Petri Nets and the Join Calculus

WS-FM 2006 Hernán Melgratti@IMTLucca-

Orc into Petri Nets

1-answer 0-answer

call

return

Site invocation

Page 7: Translating Orc Features into Petri Nets and the Join Calculus

WS-FM 2006 Hernán Melgratti@IMTLucca-

Orc into Petri Nets

1-answer 0-answer

call

return

Site invocation f > x > g

Page 8: Translating Orc Features into Petri Nets and the Join Calculus

WS-FM 2006 Hernán Melgratti@IMTLucca-

Orc into Petri Nets

1-answer 0-answer

call

return

Site invocation

f

g

f > x > g

Page 9: Translating Orc Features into Petri Nets and the Join Calculus

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

Page 10: Translating Orc Features into Petri Nets and the Join Calculus

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

Page 11: Translating Orc Features into Petri Nets and the Join Calculus

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

Page 12: Translating Orc Features into Petri Nets and the Join Calculus

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

Page 13: Translating Orc Features into Petri Nets and the Join Calculus

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

Page 14: Translating Orc Features into Petri Nets and the Join Calculus

WS-FM 2006 Hernán Melgratti@IMTLucca-

An Orc Process as a PN

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

Page 15: Translating Orc Features into Petri Nets and the Join Calculus

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)

Page 16: Translating Orc Features into Petri Nets and the Join Calculus

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)

Page 17: Translating Orc Features into Petri Nets and the Join Calculus

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

Page 18: Translating Orc Features into Petri Nets and the Join Calculus

WS-FM 2006 Hernán Melgratti@IMTLucca-

Mapping the Asym. composition

f where x: g

f g

Page 19: Translating Orc Features into Petri Nets and the Join Calculus

WS-FM 2006 Hernán Melgratti@IMTLucca-

Mapping the Asym. composition

f where x: g

f g

Page 20: Translating Orc Features into Petri Nets and the Join Calculus

WS-FM 2006 Hernán Melgratti@IMTLucca-

Mapping the Asym. composition

f where x: g

f g

Page 21: Translating Orc Features into Petri Nets and the Join Calculus

WS-FM 2006 Hernán Melgratti@IMTLucca-

Mapping the Asym. composition

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

Page 22: Translating Orc Features into Petri Nets and the Join Calculus

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

Page 23: Translating Orc Features into Petri Nets and the Join Calculus

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

Page 24: Translating Orc Features into Petri Nets and the Join Calculus

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

Page 25: Translating Orc Features into Petri Nets and the Join Calculus

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

Page 26: Translating Orc Features into Petri Nets and the Join Calculus

WS-FM 2006 Hernán Melgratti@IMTLucca-

But it doesn’t work

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

Page 27: Translating Orc Features into Petri Nets and the Join Calculus

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

Page 28: Translating Orc Features into Petri Nets and the Join Calculus

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

Page 29: Translating Orc Features into Petri Nets and the Join Calculus

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

Page 30: Translating Orc Features into Petri Nets and the Join Calculus

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

Page 31: Translating Orc Features into Petri Nets and the Join Calculus

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

Page 32: Translating Orc Features into Petri Nets and the Join Calculus

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

Page 33: Translating Orc Features into Petri Nets and the Join Calculus

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

Page 34: Translating Orc Features into Petri Nets and the Join Calculus

WS-FM 2006 Hernán Melgratti@IMTLucca-

Join

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

Page 35: Translating Orc Features into Petri Nets and the Join Calculus

WS-FM 2006 Hernán Melgratti@IMTLucca-

Join

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

x

b

x

ax xb

Page 36: Translating Orc Features into Petri Nets and the Join Calculus

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

Page 37: Translating Orc Features into Petri Nets and the Join Calculus

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

Page 38: Translating Orc Features into Petri Nets and the Join Calculus

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

Page 39: Translating Orc Features into Petri Nets and the Join Calculus

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

Page 40: Translating Orc Features into Petri Nets and the Join Calculus

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

Page 41: Translating Orc Features into Petri Nets and the Join Calculus

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

Page 42: Translating Orc Features into Petri Nets and the Join Calculus

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

Page 43: Translating Orc Features into Petri Nets and the Join Calculus

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.

Page 44: Translating Orc Features into Petri Nets and the Join Calculus

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