160 likes | 261 Views
This text by Carlos Varela from Rensselaer Polytechnic Institute explores Join Calculus programming in distributed computing systems. It bridges theory and practice, introducing reflexion to CHAM. It combines restrictions, receptions, and replications of π-calculus. The author introduces receptor definitions and reflection. The text delves into the concepts of names, processes, definitions, operational semantics, and examples like message forwarding, channels modeling, and recursion. It concludes with examples of mutual exclusion and dining philosophers.
E N D
Chapter 5: Join Calculus Programming Distributed Computing Systems: A Foundational Approach Carlos Varela Rensselaer Polytechnic Institute C. Varela
Reflexive CHAMandJoin Calculus • Attempt to overcome “distribution” issues in π-calculus, yet keeping formal investigation results. • Bridge gap between theory and practice, and form the basics for a programming language. • Imposes locality and adds reflexion to generic CHAM of Boudol and Berry. • Combines restriction, reception, and replication (of π-calculus) into a single (joint) receptor definition. C. Varela
Reflexive Chemical Abstract Machine x<y> atom M | M molecule e.g. ready<laser> ready<laser> | job<1> D or J P reaction e.g. ready<printer> | job<file> printer<file> C. Varela
Printer Example 0 ├ ready<laser>, job<1>, job<2> 0 ├ ready<laser> | job<1> , job<2> Let D = ready<printer> | job<file> printer<file> D ├ ready<laser> | job<1>, job<2> D ├ laser<1>, job<2> C. Varela
Reflection def D in P molecule 0 ├ def D in ready<laser> | job<1> | job<2> D ├ ready<laser> | job<1> | job<2> C. Varela
Names, Processes, Definitions ~ def P = x<v> asynchronous polyadic message def D in P definition of new names P | P parallel composition J = x<v> join patterns J | J D = J P matching join D D patterns to processes ~ def def C. Varela
Variable Types Received variables (join patterns) rv(x<v>) = {u in v} rv(J | J’) = rv(J) U rv(J’) Defined variables (join patterns and definitions) dv(x<v>) = {x} dv(J | J’) = dv(J) U dv(J’) dv(J P) = dv(J) dv(D D’) = dv(D) U dv(D’) ~ ~ def def ~ def def def def C. Varela
Free Variables (processes and definitions) fv(J P) = dv(J) U (fv(P) – rv(J)) fv(D D’) = fv(D) U fv(D’) fv(x<v>) = {x} U {u in v} fv(def D in P) = (fv(P) U fv(D)) – dv(D) fv(P | P’) = fv(P) U fv(P’) def def ~ ~ def def def C. Varela
Operational SemanticsStructural Equivalence (str-join) ├ P | Q ├ P,Q (“ “ heating, “ “ cooling) (str-and) D E ├ D,E├ (str-def) ├ def D in P D ├ P (red) J P ├ J J P ├ P σdv instantiates port variable dv(D) to fresh names. σrv substitutes transmitted names for distinct received variables rv(J). σdv σdv σrv σrv C. Varela
Examples • def x<u> y<u> in P messages on local name x in P are forwarded to the outside as messages on y. • def y<u> x<u> in def x<u> y<u> in P messages on local name x are forwarded in two steps on the external name x (internal x needs renaming). • def x1<u> | x2<v> x<u,v> in P performs multiplexing of messages on x whose parts are supplied on x1 and x2. C. Varela
Examples (continued) • def x<v> | y<k> k<v> in P models π-calculus-like channels, as values are sent on x and requests for values are sent on y. • def s<> P s<> Q in s<> express internal non-determinism P + Q • def once<> | y<v> x<v> in y<1> | y<2> | y<3> | once<> uses the message on once as a lock for non-determinism x<1> + x<2> + x<3> C. Varela
Recursion Example def loop<> P | loop<> in loop<> replicates the process P (!P), starting a new copy each time the definition is used. C. Varela
Reference Cell def mkcell<v0, k0> in P P = def c<g,s> s<w1,k> in mkcell <w0, c> def get<k> | s<v> k<v> | s<v> set<u,k> | s<v> k<> | s<u> in s<v0> | k0<get,set> C. Varela
Mutual Exclusion def s<> P | s<> Q | s<> in s<> (semaphore) def in s<> (guarantees mutual exclusion) s<> def JP s<> in JP s<> def JQ s<> in JQ C. Varela
Dining Philosophers def in P P = Π(phil<i, ci, c(i+1)mod n> | chopstick<ci>) phil<i,l,r> def l<> | r<> eat<i> | l<> | r<> in 0 chopstick<c> c<> 0 ≤ i < n C. Varela