[LAU] Simple, easy multithreaded circular buffer library for Linux?

Olivier Guilyardi ml at xung.org
Wed Oct 15 07:49:34 EDT 2008


Paul Davis wrote:
> On Wed, 2008-10-15 at 13:02 +0200, Olivier Guilyardi wrote:
>>
>> I'm no memory barrier expert, but from what I read this looks like a complex
>> topic. Adding them to jack's ring buffer may be hazardous without carefully
>> crafted test cases. Bugs related to missing barriers may or may not happen
>> according to various hardware-related issues.
> 
> the point of memory barriers is really to remove the need for test
> cases :)

I meant Test First, not putting a memory barrier between us and past bugs ;)

My concern is: people around say memory barriers are missing, but could anyone
write a unit test that actually turns this assumption into a bug?

>> Here's what Ross Bencina says about it: "the correct implementation of these
>> algorithms also requires an understanding of the use of memory barriers to force
>> the order of some memory reads and writes on SMP systems. This is because memory
>> controllers may reorder reads and writes as observed by other processors on an
>> SMP system (or by prehipherals on a uniprocessor system)."
> 
> what is complex about memory barriers is understanding *why* they are
> necessary. their use is really quite straightforward.

Yeah, I saw that. In Portaudio, they consist in 3 lines in the whole ringbuffer
code. But as Miles Davis (sort of) said, playing a few notes might involve a
great expertise.

>> As a user of these projects I sense that people from Portaudio, PulseAudio and
>> Jack could collaborate on this topic. And Ross Bencina's initiative may be the
>> right place for this:
>> http://www.audiomulch.com/~rossb/code/lockfree/liblfds/index.htm
> 
> if you read that page carefully you will see that ross was still waiting
> to set up a repository when that page was last updated (2006). a shame.
> though i can speak, did i do anything to help it out?

I didn't see that the page was so old.. I just saw there was "some" activity on
the mailing list (http://tech.groups.yahoo.com/group/liblf-dev/).

I'll try to find some time to work on a patch or a new lib, but I can't promise
it will happen soon.

PS: I forwarded this thread to Ross

-- 
  Olivier Guilyardi / Samalyse



More information about the Linux-audio-user mailing list