next up previous
Next: STATE controls activations and Up: INSTRUCTIONS Previous: SELECT selects messages from

SENDTO sends messages in process to lists

Syntax:

SENDTO(< | <pointer>, | A | B |>| FIRST | LAST |>, <destination list(s)>);
This instruction is used to send messages to one or more lists of messages.
<destination list> is a list of names of nodes or lists (they may be of the form EL_<node> or IL_<node>)

Message in process is sent to all these destinations (if the list has more than one element, copies are sent at each destination). If one destination is indicated by a node, it is assumed that it must be sent to the EL of the node.

The place in the destination list in which the message is put, depends on the first parameter:

When SENDTO is executed, the values in the field variables are passed to the fields of the message and this is put in the indicated place.

If this instruction is within an <associated instruction> of a GLIDER instruction, then the values in the O_<fields> are passed to the message (except for the CREATE in which the field variables are used). In the case the SENDTO is in an <associated instruction>, the sent message is:

SENDTO can be used in type G, L, I, D, E, A, and general type nodes, and in the <associated instruction> of the GLIDER instructions indicated above, such as in the RELEASE instruction.

The nodes referred to in the SENDTO instruction must be explicitly indicated in the list of successors, unless there are only one successor and it is implicitly defined as such by being the following in the program.

If the successor is a multiple node, the user have three alternatives to send a message to its ELs:

Examples:
  1.        Mail (D) :: SENDTO(Director, Secretary, File);
    Copies of the message received at Mail are sent to the nodes Director, Secretary, and File.
  2.        Discrim (G) Queue :: IF Class = Friend THEN SENDTO(FIRST, Queue)
                                                  ELSE SENDTO(LAST, Queue);
  3.        Parkman (G) Parkinglot[INO] :: SENDTO(Parkinglot[MIN]);
           Parkinglot (R) Street :: STAY := GAMMA(Tpark, DevTpark);
  4.     Ii                :: IT := 1; Pr := UNIFI(1, 4);
    
        OrdQueue (G) LINE :: IF LineGate = Closed
                             THEN
                                   BEGIN
                                   SCAN(EL_Line, Poin) IF Pr > O_Pr 
                                   THEN STOPSCAN;
                                   IF Poin < > NIL THEN SENDTO(Poin, B, Line)
                                   ELSE SENDTO(LAST,Line);
                                   END
                                   ELSE SENDTO(Line);
    
        Line (G)          :: STATE BEGIN
                                   IF LineGate = Closed THEN LineGate := Open
                                   ELSE LineGate := Closed;
                                   IT := 8
                                   END;
                                   IF LineGate = Open THEN SENDTO(Process);
    
        INIT TSIM := 100; ACT(Ii, 0); LineGate := Open; ACT(Line, 8);
    
        DECL TYPE Opcl = (Closed, Open);
                   VAR LineGate: Opcl; Poin: POINTER;
                   MESSAGES Ii(Pr: INTEGER);
    
       END.
    Messages, with priorities from 1 to 4 in the field Pr, arrive at OrdQueue and they are passed to Line if the variable LineGate has the value Open. In this case, they continue to Process. LineGate is Open and Closed each 8 time units. If LineGate is closed, then when a message reaches OrdQueue, a scan process of the EL of Line starts. If a message in the EL is found with priority less than the incoming message, then this is put before of that in the EL. So, the EL is always ordered in decreasing order of priority. In this system the entities that arrive when the gate is open are allowed to pass, when they have to wait, they are sorted according to their priority. This type of sorting may be more easily done using a type L node.
See examples 2, 6, 7, 8, 10, 11, 12, 13, 18 (GLIDER examples book).


next up previous
Next: STATE controls activations and Up: INSTRUCTIONS Previous: SELECT selects messages from

domingo c
Mon Mar 20 17:36:19 PST 2000