A forum for Spin users
You are not logged in.
Pages: 1
Currently there are 3 different ways of sending messages to a channel.
1. If the queue is full, the sender is blocked; otherwise the channel is an FIFO queue. For example chan ! x
2. If the queue is full, the sender is blocked; otherwise the channel is a sorted queue. For example chan !! x
3. If the queue is full, the sender is not blocked and the sent message is lost. With the option of -m for SPIN.
In addition to these, another option is necessary in implementation.
If the queue is full, the sender is not blocked and the new message replaces the old one in the queue.
This option is often preferred in systems transmitting data among processes. The most recent data are more important than the older ones.
In implementation, the semantics of this option is similar to a circular buffer data structure.
Offline
You can implement this functionality with a process, using an internal array to hold the messages, for instance. (Or by manipulating a standard channel inside that process that now acts as the channel.
You can also maple meant any other desired functionality in this way (e.g. Lossy channels).
Offline
Pages: 1