mutex performance

Daniel Eischen deischen at freebsd.org
Wed Nov 17 11:40:21 PST 2004


On Wed, 17 Nov 2004, Petri Helenius wrote:

> Daniel Eischen wrote:
>
> >On Wed, 17 Nov 2004, Petri Helenius wrote:
> >
> >>Do you feel that mutex performance could be improved from the current
> >>2-3 million lock/unlock operations per second on uncontested mutexes on
> >>~2.4Ghz prescott? Which seems to be about 1000 cycles per lock/unlock.

[ ... ]

> And I'm wondering how much I need to engineer around mutexes or holding
> them for longer and releasing just before yielding. I'm not saying it
> should/must be better, just trying to ask for the feel where to go.

It should get better, so...

> >I want to change libpthread locks to drop the 80386 support
> >and just use the atomic primitives for default mutex types.
> >In 6.0, we'll also change all the mutexes, CVs, and semaphores
> >so they aren't pointers -- that will save an indirection and
> >also allow them to be process shared.
> >
> Do you have patches or is this on planning stage?

Just planning.  The change from pointer type to structure is a
big change; it breaks the ABI and affects libc, libthr, libpthread,
libc_r (if we keep it around in 6.0).

Changing our current low-level locks to use the atomic functions
is less intrusive and will be done first.

-- 
DE



More information about the freebsd-threads mailing list