450 likes | 571 Views
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
E N D
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 • It does not provide any explicit mechanism for name creation 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 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 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 Hernán Melgratti@IMTLucca
Site invocation call 1-answer 0-answer return Orc into Petri Nets Hernán Melgratti@IMTLucca
call 1-answer 0-answer return Orc into Petri Nets Site invocation f > x > g Hernán Melgratti@IMTLucca
call 1-answer 0-answer return g Orc into Petri Nets Site invocation f > x > g f Hernán Melgratti@IMTLucca
call 1-answer 0-answer return Orc into Petri Nets Site invocation f > x > g Actually we need coloured tokens f x x g Hernán Melgratti@IMTLucca
call 1-answer 0-answer return Orc into Petri Nets Site invocation f > x > g f | g f g Hernán Melgratti@IMTLucca
call 1-answer 0-answer return Orc into Petri Nets Site invocation f > x > g f | g f f g g Hernán Melgratti@IMTLucca
call 1-answer 0-answer return Orc into Petri Nets Site invocation f > x > g f | g f f g g Hernán Melgratti@IMTLucca
call 1-answer 0-answer return Orc into Petri Nets Site invocation f > x > g f | g f f g g Hernán Melgratti@IMTLucca
An Orc Process as a PN (CNN(d) | BBC(d))> x > email(a,x) Hernán Melgratti@IMTLucca
An Orc Process as a PN (CNN(d) | BBC(d))> x > email(a,x) Call_CNN Call_BBC 1-answer 0-answer 1-answer 0-answer Hernán Melgratti@IMTLucca
An Orc Process as a PN (CNN(d) | BBC(d))> x > email(a,x) Call_CNN Call_BBC 1-answer 0-answer 1-answer 0-answer Return_CNN Return_BBC Hernán Melgratti@IMTLucca
An Orc Process as a PN (CNN(d) | BBC(d))> x > email(a,x) Call_CNN Call_BBC 1-answer 0-answer 1-answer 0-answer Return_CNN Return_BBC Call_Email 1-answer 0-answer Return_Email Hernán Melgratti@IMTLucca
Mapping the Asym. composition f where x: g f g Hernán Melgratti@IMTLucca
Mapping the Asym. composition f where x: g f g Hernán Melgratti@IMTLucca
Mapping the Asym. composition f where x: g f g Hernán Melgratti@IMTLucca
Mapping the Asym. composition email(a,x) where x:(CNN(d)| BBC(d)) Hernán Melgratti@IMTLucca
Call_CNN Call_BBC 1-answer 0-answer 1-answer 0-answer Return_CNN Mapping the Asym. composition email(a,x) where x:(CNN(d)| BBC(d)) Call_Email 1-answer 0-answer Return_Email Return_BBC Hernán Melgratti@IMTLucca
Call_CNN Call_BBC 1-answer 0-answer 1-answer 0-answer Return_CNN Mapping the Asym. composition email(a,x) where x:(CNN(d)| BBC(d)) Call_Email 1-answer 0-answer Return_Email Return_BBC Hernán Melgratti@IMTLucca
Call_CNN Call_BBC 1-answer 0-answer 1-answer 0-answer Return_CNN Mapping the Asym. composition email(a,x) where x:(CNN(d)| BBC(d)) Call_Email 1-answer 0-answer Return_Email Return_BBC Hernán Melgratti@IMTLucca
Call_CNN Call_BBC 1-answer 0-answer 1-answer 0-answer Return_CNN Mapping the Asym. composition email(a,x) where x:(CNN(d)| BBC(d)) Call_Email 1-answer 0-answer lock Return_Email Return_BBC Hernán Melgratti@IMTLucca
email(a,x) where x:(CNN(d)| BBC(d)) f > d > But it doesn’t work Hernán Melgratti@IMTLucca
Call_CNN Call_BBC 1-answer 0-answer 1-answer 0-answer Return_CNN But it doesn’t work email(a,x) where x:(CNN(d)| BBC(d)) f > d > Call_Email 1-answer 0-answer lock Return_Email Return_BBC Hernán Melgratti@IMTLucca
Call_CNN Call_BBC 1-answer 0-answer 1-answer 0-answer Return_CNN But it doesn’t work email(a,x) where x:(CNN(d)| BBC(d)) f > d > Call_Email 1-answer 0-answer lock Return_Email Return_BBC Hernán Melgratti@IMTLucca
Call_CNN Call_BBC 1-answer 0-answer 1-answer 0-answer Return_CNN But it doesn’t work email(a,x) where x:(CNN(d)| BBC(d)) f > d > Call_Email 1-answer 0-answer lock Return_Email Return_BBC Hernán Melgratti@IMTLucca
Call_CNN Call_BBC 1-answer 0-answer 1-answer 0-answer Return_CNN But it doesn’t work email(a,x) where x:(CNN(d)| BBC(d)) f > d > Call_Email 1-answer 0-answer lock Return_Email Return_BBC Hernán Melgratti@IMTLucca
Call_CNN Call_BBC 1-answer 0-answer 1-answer 0-answer Return_CNN But it doesn’t work email(a,x) where x:(CNN(d)| BBC(d)) f > d > Call_Email 1-answer 0-answer lock Return_Email Return_BBC Hernán Melgratti@IMTLucca
Call_CNN Call_BBC 1-answer 0-answer 1-answer 0-answer Return_CNN But it doesn’t work email(a,x) where x:(CNN(d)| BBC(d)) f > d > Call_Email 1-answer 0-answer lock Return_Email Return_BBC Hernán Melgratti@IMTLucca
Call_CNN Call_BBC 1-answer 0-answer 1-answer 0-answer Return_CNN But it doesn’t work email(a,x) where x:(CNN(d)| BBC(d)) f > d > • In any case we sequentialise several evaluations of the same expression • We should kill the running computation (i.e., remove tokens from the net). • This can be done by using inhibitor or reset arcs Call_Email 1-answer 0-answer lock Return_Email Return_BBC Hernán Melgratti@IMTLucca
Join • Join processes can be seen as dynamic and reconfigurable, coloured nets Hernán Melgratti@IMTLucca
Join • Join processes can be seen as dynamic and reconfigurable, coloured nets a x b x ax xb Hernán Melgratti@IMTLucca
a a a c c b b b x x b b x x def ax xb def ax xb in aa | cb in ab | cb Join • Join processes can be seen as dynamic and reconfigurable, coloured nets a a c x b x def ax xb in aa | ac Hernán Melgratti@IMTLucca
a x c c y y x ax def cy yx incc Join • Join processes can be seen as dynamic and reconfigurable, coloured nets Hernán Melgratti@IMTLucca
c a c y y b x c c y y x def ax def cy yx incc cy ay in ab | cc Join • Join processes can be seen as dynamic and reconfigurable, coloured nets a a b x c c y y x def ax def cy yx incc in aa | ab Hernán Melgratti@IMTLucca
f w v Any evaluation of g is done on a fresh copy of the net g z def wv {g}z in {f}w Orc into Join { f > x > g }z Hernán Melgratti@IMTLucca
{ f | g }z { f where x: g }z g f g f w z v v valx def wv | tok valx {f}z | {g}z in {f}w| {g}z| tok Orc into Join { f > x > g }z f w v g z def wv {g}z in {f}w Hernán Melgratti@IMTLucca
def kv zv in CNN(d,k) def kv | tok zv in CNN(d,k) | tok Orc into Join Using the continuation style Site invocation { CNN(d) }z CNN(d,k) We can receive more than one answer for a call Hernán Melgratti@IMTLucca
f where x: g CNN(d) def wv | tok valx def kv | tok zv in {f}w| {g}z| tok in CNN(d,k) | tok We don’t get exactly the same behaviour When x is chosen g is killed After receiving one answer, the sender is blocked After one x is chosen, all other value produced by g is ignored Only one received answer is considered 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. 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 Hernán Melgratti@IMTLucca