[LAD] Writing to an eventfd from a realtime thread

William Light wrl at illest.net
Wed Sep 24 14:34:18 UTC 2014


On Wed, 24 Sep 2014, at 16:03, Paul Davis wrote:
> On Wed, Sep 24, 2014 at 7:21 AM, William Light <wrl at illest.net> wrote:
> 
> > Hey everybody,
> >
> > I've got this audio app I'm writing which uses message passing to
> > communicate between threads (similar to the actor model). A message
> > channel consists of a ring-buffer for the actual message storage, and
> > then an eventfd so that a thread can block on its channel (or,
> > importantly, several).
> >
> > At the moment, when the audio thread (the JACK callback) needs to send a
> > message over a channel to another thread, it follows the common codepath
> > of appending the message to the channel's ring-buffer and then
> > write()ing to the eventfd. I suspect this is not real-time safe, but is
> > it something I should lose sleep over?
> >
> 
> we're still missing measurements on the performance of semaphores, fifo's
> and eventfd's when used for this purpose on modern linux. JACK itself
> uses
> FIFOs (pipes) on Linux because 10+ years ago they were the fastest and
> most
> reliable. nobody knows for sure right whether that is still true.

I'm particularly interested in primitives that I can poll() on, which
(on Linux, at least) narrows me down to things that I can get a file
descriptor for (at least, as far as I understand).

However, a while back I was curious about the same thing, so I hacked
this thing together. Not sure if this is the best testing methodology
(in fact, looking back at the code, I'm not sure what my concept was),
but at least it could be a starting point.

https://github.com/wrl/thread-sync-latency-tests

-w


More information about the Linux-audio-dev mailing list