tech-kern archive

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

Re: posix message queues and multiple receivers



Am 26.11.13 15:13, schrieb Mindaugas Rasiukevicius:
> Hi,
> 
> The question is not really kernel related.  Possibly tech-userlevel@,
> but neither it is related with NetBSD per se.

I asked here because it is implemented in the kernel and because what I
see might as well be a buglet (given that aio does not work either as
expected).


> Marc Balmer <marc%msys.ch@localhost> 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.

So what is the purpose of those interface?  When I inject a message, I
don't know which of the possibly many receivers is getting it?

I somewhat fail to understand the utility of more than one receivers.

> 
> 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.

And you really think I did not read the man pages and other docs before?
 I am almost spending the whole trying to find out more about posix
queues...





Home | Main Index | Thread Index | Old Index