> >> Think harder... one processor != one process...
> 
> > Well sure, but you don't want a spinlock in that case.
> 
> Actually you do, when the normal case is that you don't have to block.
> You want it to fall through as quickly as possible in the success case
> (the blocking case is going to suck no matter what).  Given the present
> set of available/portable technologies, spinlocks win.

I guess it could still save some CPU cycles in the single CPU case,
if you yield() instead of tight loop around TAS in the failure case.
Problem is yield and detecting single CPU is not portable.

Andreas

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Reply via email to