tech-kern archive

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

Re: posix message queues and multiple receivers

Marc Balmer <> wrote:
> 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).

No, this is exactly how a message queue works (whether it is POSIX, SysV
or some other implementation).

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

I think Martin already explained..

Imagine you just want to get a message, process it (parse, decrypt,
transform, perhaps consume multiple messages and aggregate them, or
whatever you want to do) and either pass to a next component in the
system or perhaps store it (write to disk, memory, or some database).
Instead of processing the messages in a single-threaded manner, you
can spawn multiple workers (receivers) and process them in parallel.


Home | Main Index | Thread Index | Old Index