This structure provides concurrent agents. An agent executes a monadic
command concurrently with other agents. Communication between agents
is supported by synchronization with the termination of an agent and by
client/server oriented communication via service access points
(structure ComService
). A general external choice operator is
provided to select from several communication possibilities
(structure ComChoice
).
In the current implementation agents behave preemptive with
respect to command execution, but non-preemtive w.r.t. function
evaluation. The processor is released only inbetween the monadic composition
(Com;Cont
), but not inside of functional computations or of operating
system calls. Due to this fact agents consume relative little resources;
in particular they don't allocate a hardware stack.
List of Import References :
See BOOL
See Com
See DENOTATION
See Nat
See Option
See Seq
See Void
SIGNATURE ComAgent[result]
$Date: 2010-09-30 18:24:17 +0200 (Do, 30. Sep 2010) $ ($Revision: 616 $)
SORT result IMPORT Nat ONLY nat Com[result] ONLY com ans:SORT Com[agent] ONLY com Com[void] ONLY com Void ONLY void SORT agent
Given a command describing an agents behavior the following command creates a new agent. The agent will start its execution immediatly (depth-first scheduling).
FUN agent : com[result] -> com[agent]
Given an agent, the following command waits for its termination, yielding the computed result of the agent. This command may be used in a choice:
FUN wait : agent -> com[result]
The following command kills an agent. All agents trying to
synchronize via wait
with the agent will be resumed with
a failure:
FUN kill: agent -> com[void]
The following function checks whether the answer yielded by
a wait
is a failure because the agent waited for was
killed:
FUN killed? : ans[result] -> bool
The following command yields the running agent:
FUN self : com[agent]
next node: ComChoice,
prev node: Subsystem Concurrent Opal,
up to node: Subsystem Concurrent Opal