[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: spinlocks (was Re: [f-cpu] another DATE report)



Yes, that's true. Load_lock and store_conditional is another way to have the
CAS capability.

I don't know if a CAS is easier to implement than a pair ll/sc.

> > A real semaphore (with an initial count > 1) is a little harder...
> > We'd need another instruction in order to implement that efficiently,
> > like `atomic test-for-zero-and-decrement-otherwise'.
>
> using load_lock and store_conditional, it's easy : just do a substraction
> with saturation, instead of the xor in my latest example. that's all. voilą.
>
> >  Michael "Tired" Riepe <Michael.Riepe@stud.uni-hannover.de>
> WHYGEE
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> *************************************************************
> To unsubscribe, send an e-mail to majordomo@seul.org with
> unsubscribe f-cpu       in the body. http://f-cpu.seul.org/

*************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/