[alsa-devel] Lock free ring buffers and SMP safety
Takashi Iwai
tiwai at suse.de
Fri Nov 23 18:15:38 CET 2007
At Sun, 18 Nov 2007 17:31:52 +0000,
Matt Bucknall wrote:
>
> Hello,
>
> Yes, this old chestnut. I've spent the best part of today trying to
> ascertain whether or not, in practical terms, a single-producer,
> single-consumer lock free ring-buffer can be written purely in C/C++ and
> be SMP safe on multiple architectures without memory barriers.
> Information I've found has been largely conflicting so I've given up
> trying to get a conclusive answer. Instead I'll just go with the flow.
>
> What is the general consensus amongst ALSA application developers when
> it comes to implementing this kind of buffer? Is it possible to use
> memory barriers through some user space API call that I don't know about?
Well, this question will be better answered on LAD, maybe.
AFAIK, the lock-free ringbuffer is possible in most architectures with
a help of memory barriers or atomic ops. But these arch-specific
things are still headaches if you think of portability, of course.
Takashi
More information about the Alsa-devel
mailing list