[erlang-questions] On selective receive (Re: eep: multiple patterns)

Vlad Dumitrescu <>
Wed Jun 4 15:27:02 CEST 2008

On Wed, Jun 4, 2008 at 2:51 PM, Andreas Hillqvist <
> wrote:

> One possebility with Multiple Queues is that it would be possible to
> Prioritize messages more efficiently:
>  * If there is a message in Queue read messsage, else repeat for next
> Queue.
>  * If there is no message in any Queue, wait for a message from any Queue.
> It might be nice to have one Queue for system messages and such.
> I do not know if the Multiple Queues is the right path.
> It would be possible to build some of the functionality with helper
> process for Queue.

I think that conceptually, multiple queues would be just like wrapping all
messages with {QueueId, Message} and use selective receive to discriminate,
only faster. Especially if one queue is low priority and high volume.

I think that it is enough with only one extra queue, for system messages.
With it, it's very easy to implement any number of queues with the help of
assisting processes. The system queue would be used to send receive requests
to the helper process without these requests getting in a possibly large
queue of normal messages.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080604/70d796ec/attachment.html>

More information about the erlang-questions mailing list