|
From: Jeremy F. <je...@go...> - 2005-05-19 23:08:52
|
Nicholas Nethercote wrote:
> Currently we have two implementations of the sema stuff. One is
> futex-based and one uses pipes. AIUI, the futex one is conceptually
> nicer but in practice there's no noticeable difference in speed, and
> they're similar amounts of code. The futex one is not being used --
> it's all #ifdef'd out.
>
> We're not going to be able to switch completely to the futex approach
> so long as we support 2.4 kernels, which I imagine will be for quite
> some time yet. Also, other OSes like the BSDs don't have futexes.
>
> It doesn't make much sense to me to have two implementations of
> something, with one slowly bitrotting because the preprocessor ignores
> it. What do people think about removing the futex implementation?
There's no strong reason to keep it, but it's nice to have multiple
implementations of the semaphore so that the fact that the current one
is implemented with a pipe doesn't become part of the interface. Other
systems will want other synchronization primitives; pipes are fairly
universal, but not necessarily efficient (though they're pretty close to
optimal on Linux).
J
|