This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Spin locks


Hi,

Here's a quick note to let people know that I'm working on
implementing the POSIX spin locks that are in the current IEEE
Std. 1003.1-200X draft.  I'm trying to get things integrated with the
existing Mach/Hurd spin lock implementation that's already present in
glibc (I'm recycling some of the Hurd code in the POSIX spin locks,
and will reimplement the Mach spin locks on top of the POSIX spin
locks.

There's on thing that I'd like your opinion on:

The current spin lock implementation is based on a simple test-and-set
operation, and is aggressively inlined.  I think the idea is to avoid
function calls when there is no lock contention (note that the
origional CMU Mach cthreads code does the same thing).  However, by
inlining we expose the internal implementation, and this somewhat
reduces the flexability to change the implementation in the future.
It also makes it hard to provide an implementation that does
additional sanity checking (locking a lock that's already held by a
thread, deadlocks etc.).  Personaly I think that's not what we should
worry about.  Spin locks should be fast and simple.

Mark

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]