Spin locks

Mark Kettenis kettenis@wins.uva.nl
Fri May 5 10:25:00 GMT 2000


   From: Ulrich Drepper <drepper@redhat.com>
   Date: 05 May 2000 09:59:49 -0700

   Mark Kettenis <kettenis@wins.uva.nl> writes:

   > Anyway, I've taken a look at the code in linuxthreads/spinlock.c, but
   > it looks to me as if your implementation is more like a fast and
   > simple mutex than a spin lock.  In fact the only different between a
   > spin lock and a PTHREAD_MUTEX_FAST_NP mutex, is that you avoid the
   > check of the mutex type.

   Well, this is the only way to avoid priority inversion.  If you know
   nothing abou the other thread contesting for the spinlock you will run
   into these problems.  My understanding is the priority iversions must
   be handled gracefully.

Version 3 of the Austin draft says on the page for
pthread_spin_lock():

APPLICATION USAGE

   Applications using this function may be subject to priority
   inversion, as discussed in the System Interface Definitions volume
   of IEEE Std. 1003.1-200x, Section 3.290, Priority Inversion.

So this seems to be not the case.

Mark


More information about the Libc-hacker mailing list