Sender and receiver communicating via a channel by issuing send and receive operations on ports; read policy and transmission policy define communciation details.
As basic thinking model, reading and writing to channels happens during runnable execution in distinct phases:
A channel is specified by two attributes:
In other words, no more than maxElements elements of the given type may be stored in the channel.
In the basic thinking model, all elements are stored as a sequential collection without buffer size limit (unlimited storage).
A runnable may send elements to a channel by issuing a send operations.
The send operation has a single parameter:
A runnable may receive elements from a channel by issuing receive operations.
The operation has multiple aspects:
The port type defines the direction the receive operations take effect: accesses from LIFO ports are from top of the sequential collection, while accesses from FIFO ports are from bottom of the sequential collection.
Each operation has two parameters and several attributes specifying the exact behavior:
Receive operations then are written in function notation, that is Read(n, i) and Take(n, i). For convenience, the index may be left out for default value ‘0’ (Take(n,0) == Take(n)). See next figure for examples which elements are denoted by receive operations for FIFO and LIFO ports.
Additional attributes further define the receive operation:
As three specific read policies are frequently used, these are introduced in the following.
| Policy | Port Type | Operation | lower bound | must be new |
|---|---|---|---|---|
| Last(x) | LIFO | Read(x,0) | x | false |
| New(x) | LIFO | Read(x,0) | 0 | true |
| AllNew | FIFO | Take(sizeOfChannel,0) | 0 | true |
An example of the different behavior of the New and Last policy is shown in the next figure. For demonstration purpose, in the example periodic triggering of the receiving runnables R1 and R2 and sporadic data writing by runnable S is assumed. Note that while New may be used on an empty channel, Last would lead to an error (dashed boxes).
Left: Static connection between three runnables (S, R1, and R2). Right: Dynamic view of writing elements to channel over time (green arrows), runnable execution indicated as blue boxes, and the resulting received elements shown in square brackets.
To further specify how elements are accessed by a runnable in terms of computing time, an optional transmission policy may specify details for each receive and send operation. The intention of the transmission policy is to reflect computing demand (time) depending on data.
the transmission policy consists of two attributes:
Example for using transmission policy to detail the receiving phase of a runnable execution. Two elements are received, leading to transmission time as given in the formula. After the receiving phase, the runnable starts with the computing phase.