swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FAction


From: Marcus G. Daniels
Subject: Re: FAction
Date: 06 Sep 2000 07:54:29 -0700
User-agent: Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.4

>>>>> "FW" == Fred Wan <address@hidden> writes:

FW> in some of the java examples I found two different ways of
FW> sending a message to each member in a collection (mostly
FW> lists).

Ok, there are four ways to associate an action with a set:

  1) The general and historically common case is to use ActionForEach.

     With ActionForEach, the set can consist of agents of different types.
     When a message is ultimately sent to an object, no assumptions about
     the object will be made.  The type of the object will be used to
     direct dispatch to an agent method implementation.  For example,
     suppose you have several animals that can `eat'.  The animals may eat
     in different ways depending on their species.  Carnivores will eat other
     animals and herbivores will eat plants.  Still, they share the notion of
     eating.  

     The down side of ActionForEach is that figuring out what `eat' means
     for each agent in the set requires several steps of indirection.  
     That can waste a fair amount of time, especially for Java models.

  2) A more specific construct is ActionForEachHomogeneous.  The usage
     is the same, however by using this interface you are promising
     that the set will all be of the same type.  This has the
     advantage that the meaning of `eat' can be ascertained ahead of
     time once and for all.  When you know that your set is
     homogeneous, you can get a significant speed-up.
     
 3a) FActionForEachHeterogeneous

     FAction stands for `foreign action'.  Swarm is a C library that
     has the notion of language layers.  For example, in Java, when
     Swarm performs the Schedules and ActionGroups in a Swarm, it ends
     up having to use a Sun interface called Java Native Interface to make
     a callout to Java.  Similarly, the new COM interface to Swarm has
     its own way to make a call.  FAction is the feature in Swarm that
     unifies this callout process.

     FActionForEachHeterogeneous is like ActionForEach, but it is specialized
     to a language context.  Use of this interface can remove a couple
     indirections for sets of `foreign' [Java, COM] agents.  (This interface
     won't really help for Objective C models.)
     

  3b) FActionForEachHomogeneous

      This is like ActionForEachHomogeneous, but it is specialized to
      a language context *and* a particular method implementation.  

      FActionForEachHomogeneous gives the best performance, but also
      is the most complex to set up.

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]