A channel is an abstract mechanism that Diamond uses to transfer messages (data) efficiently from one task to exactly one other task. The two communicating tasks may be on the same processor, on processors directly connected by a physical link, or on processors that must be reached via a sequence of links.
The configurer can deal with three types of channel:
| Internal | A channel will be internal if it connects two tasks on the same processor. Transfers will be achieved by some sort of memory copy (memcpy, for example). |
|---|---|
| Physical | A physical channel connects two tasks on separate processors that have a physical communication link between them. Transfers will be achieved using device drivers, interrupts, and DMA where it is appropriate and available. |
| Virtual | A virtual channel connects two tasks on separate processors where there may be no direct physical connection. Transfers will be achieved using system tasks to relay the message via the intervening processors. The configurer will automatically choose an appropriate route that guarantees that the message transfer will not deadlock. By default, all channels that are not internal will be virtual. |
The Diamond configurer will convert from the abstraction of a channel into a physical mechanism appropriate to the placement of tasks. The properties of the channel communication are independent of the actual mechanism used to move the data, so tasks can be written without you having to worry about the placement of tasks on processors. This gives great flexibility and allows decisions about task placement to be left until late into the application development cycle.
Data transfers on channels have three significant properties: they are unidirectional, unitary, and blocking.
Unidirectional | A channel can transfer a message in only one direction, from a transmitting task to a receiving task. If you need communication in both directions between tasks, you need two channels. |
|---|---|
| Unitary | Both the transmitter and receiver must agree on the size of the message being transmitted. This can be arranged either statically, both ends "knowing" what's happening, or dynamically by sending two messages: the first being a single word containing the length of the data and the second the actual data. |
| Blocking | A transmitting thread will be suspended until the receiving thread has actually read the message. Similarly, a receiving thread will by suspended until the transmitting thread has sent the message. Other threads will continue to execute while communicating threads are suspended. |




