[linux-audio-dev] Lock Free Ringbuffer in C ?

Ingo Oeser ingo.oeser at informatik.tu-chemnitz.de
Sat Apr 5 09:10:01 UTC 2003


On Fri, Apr 04, 2003 at 07:43:40AM -0500, Paul Davis wrote:
> there are several solutions, none of them particularly good. the best
> is to wait on a FIFO. these provide a fast, 99% non-blocking way to
> get 1 process to wake up another. the "real" solution needs to be
> provided by the kernel, and futexes in 2.5/2.6 will be fairly
> close. they are still not completely correct for our purposes, but
> they will probably work OK.

The futexes are the solution. You can basically wait, until a
long at a specified address is changed, if you tell the kernel
that it might be changed, after you did. So the kernel just does
the sleep/wakeup for you, nothing else.

But you can also just do what you want and use the NPTL of RH9,
which uses futexes transparently, if available.

That way you get a performance gain on machines you recommend
while still being correct on every other machine with POSIX
threading implemented.

Regards

Ingo Oeser
-- 
Marketing ist die Kunst, Leuten Sachen zu verkaufen, die sie
nicht brauchen, mit Geld, was sie nicht haben, um Leute zu
beeindrucken, die sie nicht moegen.



More information about the Linux-audio-dev mailing list