Can Actors and -Agents Live Together? - CiteSeerX

4 downloads 0 Views 221KB Size Report
In the paper, the behavior of both actors and -agents is defined by certain logic sequents called tiles. A tile is a rewrite rule which describes a possible evolution ...
Electronic Notes in Theoretical Computer Science 10 (1998)

URL: http://www.elsevier.nl/locate/entcs/volume10.html

8 pages

Can Actors and -Agents Live Together? Ugo Montanari 1 Dipartimento di Informatica Pisa, Italy [email protected]

Carolyn Talcott 2 Department of Computer Science Stanford University Stanford, CA, USA [email protected]

Abstract The syntax and semantics of actors and -agents is rst de ned separately, using a uniform, \unbiased" approach. New coordination primitives are the added to the union of the two calculi which allow actors and -agents to cooperate.

1 Modeling Actors and Agents The syntax and semantics of actors and -agents are rst de ned separately, using a uniform, \unbiased" approach. Since we aim at modeling concurrent distributed systems, and thus we are interested in asynchronous behavior, we choose for comparison with actors an asynchronous version of the -calculus. In the paper, the behavior of both actors and -agents is de ned by certain logic sequents called tiles. A tile is a rewrite rule which describes a possible evolution of a part s of the system which is matched by it. In addition, a tile also describes the evolution of the interfaces of s with the rest of the system. Thus two parts s and s sharing an interface can be rewritten only by tiles which agree on the evolution of the common interface. This restriction 0

Research supported in part by CNR Integrated Project Metodi e Strumenti per la Progettazione e la Veri ca di Sistemi Eterogenei Connessi mediante Reti di Comunicazione; and Esprit Working Groups CONFER2 and COORDINA. Work done while the rst author was visiting the Computer Science Laboratory, SRI International, Menlo Park. 2 Research was partially supported by ONR grant N00014-94-1-0857, NSF grant CRR9633419, and DARPA/Rome Labs grant AF F30602-96-1-0300,

1

c

1998 Published by Elsevier Science B. V.

Montanari-Talcott

introduces a powerful notion of synchronization 3 among tiles, and also makes possible to see the synchronization of two tiles as a (larger) tile. Eventually, all the possible evolutions are obtained by the repeated composition (synchronized, or in sequence, or in parallel) of certain small basic tiles called rewrite rules. In the case of actors and -agents, it is convenient to take a coordination [19] point of view and to distinguish between the behavior of agents in isolation and the behavior of coordinators, i.e. of system components whose role is to connect agents and to control their behavior. This approach allows us to abstract from the behavior in the small of agents, which is presented in a state transition, syntax-independent form, and to focus on the behavior of coordinators, which are the most characteristic feature of distributed systems. Correspondingly, we distinguish between two kinds of rewrite rules: activity rules and coordination rules. An activity rule describes an evolution of a single sequential agent, and may produce some action at its interface with the rest of the system. A coordination rule describes an evolution of a coordinator, and may both require certain actions from the agents it controls, and produce actions for a coordinator operating at a higher level. For actors and -agents, the interfaces with the rest of the system contain the free names of the agent, or, equivalently, the acquaintances (including self) of the actor. We call both of them names. An important di erence with the ordinary semantics of both calculi is that in our approach names have only a local scope. Thus if in a particular subsystem there are n names, we can just denote them with x1 ; x2 ; : : : ; xn. This choice makes the handling of names much easier, especially in the presence of bound (restricted) names and of name extrusion steps: it avoids -conversion, in nite branching and in general the need of making provisions for an in nite number of possible names when connecting with the external world. In addition to names, the interfaces contain also events. Events are the mechanism we use for establishing concurrency control in a distributed system. Agents and messages include references to the events which generated them, and to the previous events which caused these events. For instance in the event diagram semantics [11,33], when a message is received, a new event is created, and pointers to it and its causes are made available to all the components spawned by the step. The causes of this new event are the events both the message and the receiving agent pointed to. The causal relation determines the orderings in which the events can happen: all the sequential orderings compatible with the causal relation are possible, and they correspond to the same concurrent computation. In the representation of agents, actions and events, the key notion is sharing. In fact, the only role of a name is to specify which agents share it, and Even in an asynchronous system, synchronization is required to model the reception of messages and the extrusion of names.

3

2

Montanari-Talcott

similarly several events may share the same cause. Sharing is a well-studied notion from a formal point of view, in particular for the subterms shared by a term. For instance, terms can be broken into the parallel and sequential composition of term constructors and basic substitutions, modulo certain axioms. Sharing in its purest form is then represented by the basic substitution r from one variable to two values: r : 1 ! 2 = fy1 := x1 ; y2 := x1 g: However, in the algebra of terms and substitutions, sharing is not a rst class component, in the sense that it can be freely removed by copying the shared subterm. In the paper, instead of terms we use term graphs. They are more expressive than terms, since terms graphs with a di erent amount of sharing among subterms are actually di erent. As a consequence, in term graphs, the r operator becomes a basic constructor.

2 Interoperability of Actors and Agents In the ordinary syntax of actors and -agents, we have three con guration operators: parallel composition, restriction and renaming. Parallel composition is very powerful, since references to the same name on both operands are automatically identi ed. In our approach, since names are only local, parallel composition considers all names as di erent and yields the union of the two subsystems without establishing any connection between them. Names are actually identi ed by the  matching operator, which is thus our second coordinator. The  operator is analogous but opposite to r, since it merges two names, or two events, into one, rather that creating two instances of the same variable. It replaces both variable substitution [ = ] and parallel composition j , which turn out, somewhat surprisingly, to have analogous meanings. Renaming, which is of dicult interpretation in a distributed setting, becomes useless and is discarded 4 . Restriction is mantained, essentially with the same meaning. The main di erence between actor calculus and -calculus resides, in our setting, in the di erent typing of names and in the di erent versions of 's and their coordination rules. The free names of a -agent are all typed c (for channel) and thus there is only one , which we call c. Given an actor, its name is typed a, while its acquaintances are typed r (for reference). Also, all the acquaintances of a message, including its addressee, are typed r. There are only two 's: r accepting two references and yielding a reference, and a accepting an actor and a reference and yielding an actor. There is no  accepting two actors: this restriction fully enforces the uniqueness of actor A weak notion of renaming, permutations, is used. They correspond exactly to substitutions of the form  : 2 ! 2 = fy1 := x2 ; y2 := x1 g. However, they just describe a \wire twisting", they have no coordinating role, and no rewrite rule matches a substitution. 4

3

Montanari-Talcott

Coordinator a r c  ac  cr Type ar ! a rr ! r cc ! c ar !  rc !  Permeability to : output n y y n n input y ? y n n synchronization y ? y y y Table 1 Permeability of coordinators for name sharing.

names. The behaviour of a  is determined by its permeability to input/output actions and to synchronization. It is easy to see that c must be permeable to everything, while r cannot be presented with any input action, and thus cannot synchronize either. The most interesting case is a , which is permeable to input and synchronization, but impermeable to output. The rationale under this restriction is that a message cannot exit a system if its addressee is inside the system. The permeability of the various  coordinators is summarized in Table 1. Actors and -agents are connected by coordinators that match channels and actor names or references and restrict visibility of the matched pair.  ac accepts an actor name and a channel and yields nothing.  ac allows a message to be sent from a -agent to the named actor, by sending the message on the matching channel. Symmetrically,  cr accepts a channel and an actor reference and yields nothing.  cr allows a message to be sent from an actor to a -agent receiving on the named channel, by sending the message to the matching actor reference. The hiding aspect of the actor- coordinators enforces a clean separation between the two worlds, preserving the local behavior of individual agents and making the interaction invisible to the outside world. To enforce this separation, names communicated in messages are required to be newly created and the coordination rule matches and hides them appropriately. The permeability of the actor- coordinators is also summarized in Table 1. Both calculi are equipped with mobility, thus the amount of name sharing established at con guration time can be modi ed, actually only increased, at run time. In our setting, new 's are created only by input instantiation, by a synchronization where the output action is extruding (similar to a Close step for -calculus) , or by an activity tile describing the forking of some actor or some -agent. In these cases only homogeneous subsystems, either both actors or both -agents, are connected. Synchronization via an actor- coordination rule creates a new coordinator to match (and hide) the actor and  versions of the communicated name. For full composability we have required that agent behavior can not test 4

Montanari-Talcott

for equality of names (no matching construct in process algebra terms). This restriction is also made for the actor language studied in [4]. The restriction was removed in the langauge studied in [23] in order to implement synchronous message passing (remote procedure call) in terms of asynchronous communication. An alternative might be to allow actors to receive on more than one port. We conjecture that the partial order on events that is the observation of a tile-based computation for actors gives the same semantics to actor components as the interaction diagram semantics of [33] for the case of actor behaviors without matching. The event-based semantics for the -calculus is new, and seems like a natural framework both for comparing calculi for concurrent/distributed computation and for semantic interoperation of heterogeneous systems.

3 Related Work The actor model [20,6,1,2] is one of the rst and best known models for concurrent distributed systems and consists of independent computational agents which interact solely via asynchronous message passing. Semantic foundations for actor computation have been given in [4,31{33]. An approach to specifying and implementing mechanisms for coordination of actors based on re ection is described in [3]. The -calculus [28] is one of the best studied examples of mobile process calculi, namely calculi in which the communication topology among processes can dynamically evolve when computation progresses. The asynchronous version of the -calculus has been introduced in [8,21] and studied in [5]. The tile model, introduced in [16], is described in general terms in [17,18]. Tiles are much like SOS inference rules [30], but they can be composed horizontally, vertically and in parallel to build larger proof steps. Tile systems generalize Kim Larsen and Liu Xinxin context systems [22] since they allow for more general rule formats. The tile model also extends rewriting logic [24{26] (in the nonconditional case), since it takes into account rewritings with side e ects and rewriting synchronization. Tile systems can be seen as double categories [13] and tiles themselves as double cells. They can be equipped with observational equivalences and congruences. The combined used of tiles and term graphs [7,12] for modeling asynchronous -calculus and CCS with locations [9] has been described in [14,15]. Also coordination models equipped with exible synchronization primitives are presented in [29,10]. Ongoing work [27] aims at translating the tile model into rewriting logic, in order to take advantage of important features of rewriting logic, like execution strategies and re ective logics, and to employ its existing implementations. 5

Montanari-Talcott

References [1] G. Agha, Actors: A Model of Concurrent Computation in Distributed Systems, MIT Press 1986. [2] G. Agha, Concurent Object Oriented Programming, CACM 33 (9), pp.125-141, 1990. [3] G. Agha. Abstracting interaction patterns: A programming paradigm for open distribute systems. In E. Najm and J-B. Stefani, editors, Formal Methods for Open Object-based Distributed Systems, pages 135{153. Chapmn & Hall, 1997. [4] G. Agha, I.A. Mason, S.F. Smith and C.L. Talcott, A Foundation for Actor Computation, J. of Functional Programming, 7, pp.1-72, 1997. [5] R. Amadio, I. Castellani, D. Sangiorgi, On Bisimulations for the Asynchronous -calculus, CONCUR'96, LNCS, 1996. [6] Henry G. Baker and Carl Hewitt. Laws for communicating parallel processes. In IFIP Congress, pages 987{992. IFIP, August 1977. [7] H.P. Barendregt, M.C.J.D. van Eekelrn, J.R.W. Glauert, J.R. Kennaway, M.J. Plasmeijer, M.R. Sleep, Term Graph Reduction, Proc. PARLE, Springer LNCS 259, 141{158, 1987. [8] G. Boudol, Asynchrony and the -calculus (note), Rapport de Recherche 1702, INRIA Sophia-Antipolis, May 1992. [9] G. Boudol, I. Castellani, M. Hennessy and A. Kiehn, Observing Localities, Theoretical Computer Science, 114: 31{61, 1993. [10] R. Bruni and U. Montanari, Zero-Safe Nets, or Transition Synchronization Made Simple, in: Catuscia Palamidessi, Joachim Parrow, Eds, EXPRESS'97, ENTCS, Vol. 7, http://www.elsevier.nl/locate/entcs/volume7.html. [11] W. D. Clinger. Foundations of Actor Semantics. PhD thesis, MIT, 1981. MIT Arti cial Intelligence Laboratory AI-TR-633. [12] A. Corradini, F. Gadducci, A 2-Categorical Presentation of Term Graph Rewriting, Proc. CTCS'97, Springer LNCS, to appear, 1997. [13] C. Ehresmann, Categories Structurees: I and II, Ann. E c. Norm. Sup. 80, Paris (1963), 349-426; III, Topo. et Geo. di . V, Paris (1963). [14] G.L. Ferrari and U. Montanari, A Tile-Based Coordination View of Pi-Calculus, in: Igor Prvara, Peter Ruzicka, Eds., Mathematical Foundations of Computer Science 1997, Springer LNCS 1295, 1997, pp. 52-70. [15] G. Ferrari, U. Montanari, Tiles for Concurrent and Located Calculi, in: Catuscia Palamidessi, Joachim Parrow, Eds, EXPRESS'97, ENTCS, Vol. 7, http://www.elsevier.nl/locate/entcs/volume7.html.

6

Montanari-Talcott

[16] F. Gadducci, On the Algebraic Approach to Concurrent Term Rewriting, PhD Thesis, Universita di Pisa, Pisa. Technical Report TD-96-02, Department of Computer Science, University of Pisa, 1996. [17] F. Gadducci, U. Montanari, The Tile Model , in: Gordon Plotkin, Colin Stirling, and Mads Tofte, Eds., Proof, Language and Interaction: Essays in Honour of Robin Milner, MIT Press, to appear. Paper available from http://www.csl.sri.com/ ugo/festschrift.ps. [18] F. Gadducci and U. Montanari, Tiles, Rewriting Rules and CCS, in: J. Meseguer, Ed., Procs. Rewriting Logic and Applications, First International Workshop, ENTCS, Vol. 4 (1996), http://www.elsevier.nl/locate/entcs/volume4.html. [19] D. Garlan, D. Le Metayer, Eds., Coordination Languages and Models, LNCS 1282, 1997. [20] C. Hewitt, Viewing Control Structures as Patterns of Passing Messages, J. of Arti cial Intelligence, 8(3), pp.323-364, 1977. [21] K. Honda, M. Tokoro, An Object Calculus for Asynchronous Communication, In: M. Tokoro, O. Nierstrasz, P. Wegner, Eds., Object-Based Concurrent Computing, Springer LNCS 612, 21{51, 1992. [22] K.G. Larsen and L. Xinxin, Compositionality Through an Operational Semantics of Contexts, in Proc. ICALP'90, LNCS 443, 1990, pp. 526-539. [23] I.A. Mason and C.L.Talcott, A Semantically Sound Actor Translation in Proc. ICALP'97, LNCS 1256, 1997, pp. 369-378. [24] J. Meseguer, Conditional Rewriting Logic as a Uni ed Model of Concurrency, Theoretical Computer Science 96, 1992, pp. 73-155. [25] J. Meseguer, Rewriting Logic as a Semantic Framework for Concurrency: A Progress Report, in: U. Montanari and V. Sassone, Eds., CONCUR'96: Concurrency Theory, Springer LNCS 1119, 1996, 331-372. [26] J. Meseguer, Ed., Procs. Rewriting Logic and Applications, First International Workshop, ENTCS, Vol. 4 (1996), http://www.elsevier.nl /locate/entcs/volume4.html. [27] J. Meseguer and U. Montanari, Mapping Tile Logic into Rewriting Logic, paper submitted for publication. Draft available from http://www. csl.sri.com/ ugo/wadt.ps. [28] R. Milner, J. Parrow, D. Walker, A Calculus of Mobile Processes (parts I and II), Information and Computation, 100:1{77, 1992. [29] U. Montanari, F. Rossi, Graph Rewriting and Constraint Solving for Modelling Distributed Systems with Synchronization, in: Paolo Ciancarini and Chris Hankin, Eds., Coordination Languages and Models, LNCS 1061, 1996, pp. 12-27. Full paper submitted for publication available from http://www.csl.sri.com/ ugo/graphs.ps.

7

Montanari-Talcott

[30] G. Plotkin, A Structural Approach to Operational Semantics , Technical Report DAIMI FN-19, Computer Science Department, Aarhus University, 1981. [31] C.L.Talcott, An Actor Rewriting Theory, in: J. Meseguer, Ed., Procs. Rewriting Logic and Applications, First International Workshop, ENTCS, Vol. 4 (1996), http://www.elsevier.nl/locate/entcs/volume4.html. [32] C. L. Talcott. Interaction semantics for components of distributed systems. In E. Najm and J-B. Stefani, editors, 1st IFIP Workshop on Formal Methods for Open Object-based Distributed Systems, FMOODS'96, 1996. proceedings published in 1997 by Chapman & Hall. [33] C. L. Talcott. Composable semantic models for actor theories. In T. Ito M. Abadi, editor, Theoretical Aspects of Computer Science, number 1281 in Lecture Notes in Computer Science, pages 321{364. Springer-Verlag, 1997.

8