Pthread spin locks

Daniel Eischen deischen at freebsd.org
Mon Mar 19 18:05:00 UTC 2007


On Mon, 19 Mar 2007, Peter Holmes wrote:

> I have a related question - it would be great if someone could help me. Let's 
> say there are multiple system scope pthreads running on an SMP system. Is 
> there a chance that if a pthread holding a spinlock is scheduled out (due to a 
> scheduling decision etc.) then other pthreads will be starved. Is there 
> anything the system provides to guard against pthread starvation.

No, especially if the threads hold other locks.
I have no idea why POSIX added spinlocks.  I don't
see why anyone would want to use them.

-- 
DE


More information about the freebsd-hackers mailing list