Subject: Re: Lock benchmarks
To: Jason R Thorpe <>
From: Gregory McGarry <>
List: tech-kern
Date: 09/19/2002 08:33:18
Jason R Thorpe wrote:
>  > The assembler routines will be the ones used in the pthread library
>  > if it is decided that RAS locks should be used by default on
>  > uniprocessor machines.  I guess the jury is still out on that one.
> I have some comments on the asm:
> 	1. In a RAS locking scheme, you only ever want to provide
> 	   or use the "lock_try" version.  This is because if the
> 	   lock is held, know either: (a) you need to context
> 	   switch, (b) you need to croak (deadlock).  If you spin
> 	   around, then you're just consuming cpu time, and might
> 	   deadlock if your threads aren't being timesliced against
> 	   each other.

Yep.  And the pthread library currently works like that.

	-- Gregory McGarry <>