tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: posix message queues and multiple receivers


The question is not really kernel related.  Possibly tech-userlevel@,
but neither it is related with NetBSD per se.

Marc Balmer <> wrote:
> What is the prupose or reasoning behind the fact that multiple processes
> can open a message queue for reading using mq_open()?
> I wrote simple mq sender and mq receiver programs; when I start multiple
> receivers on the same mq, and send a message to it, only one of the
> receivers gets the message, in a round robin fashion.  That is probably
> by design, but if a mq is meant to connect only two processes, why can
> more than two processes open it?

Why do you think it is meant to connect only two processes?  It is an
asynchronous inter-process communication mechanism, it is just a FIFO
queue of messages.  To expand what Martin said, you can have multiple
producers and multiple consumers (M:N, not only 1:N or M:1) since it
really depends on what are you build on top of this interface.

These are basic IPC concepts.  I would suggest to Google for "POSIX
message queue" or just check the Wikipedia page first.  We also have
a pretty good mqueue(3) manual page.


Home | Main Index | Thread Index | Old Index