[linux-audio-dev] futex vs lock-free

Tom Schouten doelie at zzz.kotnet.org
Thu Aug 26 19:10:05 UTC 2004


> >in other words, how much better (apart from being more elegant) are lock
> >free structures wrt a mutex approach where there is a minimal system
> >penalty? (not many collisions) did anyone look into this? or have i not
> >been lurking properly? ;)
> >
> OK, futexes are fast in the uncontested case so, with sufficiently rare
> collisions, you expect performance to approach that of a lock-free
> implementation.
>
> And in terms of overall throughput, it probably does. But in terms of
> worst case delay when there *is* a collision things are no better. The
> point of the lock-free approach is to minimise this worst case delay in
> a real-time system, so if this is important to you then lock-free is the
> way to go (but see below).
>

clear. the hard vs. soft rt thing. thanks for explaining, simon.

small remark though. if i'm correct, most lock-free approaches use compare
and swap, and during collisions there will be a retry. am i correct in
saying this retry-delay will be neglegible compared to system overhead for
a futex?

or in other words, it seems to me that in theory this retry-time is not
bounded in time, just the probability decays very fast. so not exactly
hard rt, though it's treated as if it is, because multiple retries become
very unlikely.

something like that?

> I'm not sure if/when they'll become mainstream, but fuqueues might also be
> worth a quick look. (Yes: It is an unfortunate name. Enough said.)

thanks for the tip. sure looks interesting.
seems i need to do more digging before attacking the issue.

cheers
tom




More information about the Linux-audio-dev mailing list