Re: [LAD] Pipes vs. Message Queues

From: David Robillard <d@email-addr-hidden>
Date: Fri Nov 25 2011 - 22:51:41 EET

On Fri, 2011-11-25 at 13:33 +0100, Clemens Ladisch wrote:
> Nick Copeland wrote:
> > > I got curious, so I bashed out a quick program to benchmark pipes vs
> > > POSIX message queues. It just pumps a bunch of messages through the
> > > pipe/queue in a tight loop.
[...]
> The difference between pipes and message queues is that the latter are
> typically used for synchronization, so it's possible that the kernel
> tries to optimize for this by doing some scheduling for the receiving
> process.
[...]
> > > The first result really has me thinking how much Jack would benefit from
> > > using message queues instead of pipes and sockets.
>
> My guess: not at all, because Jack's payload isn't big enough to matter.

As you say, they are typically used for synchronization, which is
precisely what Jack needs. It seems reasonable that something
specifically designed for realtime synchronous communication might be
better. The payload is nothing.

Of course, for just sync, semaphores would probably be best anyway (they
certainly are in a single process but I have never tested shared ones),
but Jack does not use them because it needs to wait on several things,
which you can't do with semaphores. Message queues are intriguing
because it seems like they could replace both the synchronization pipe
and the server socket, so clients would be using just one wait mechanism
+ communication channel, and a faster one at that.

-dr

_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Sat Nov 26 00:15:05 2011

This archive was generated by hypermail 2.1.8 : Sat Nov 26 2011 - 00:15:05 EET