[PATCH] PPC atomic.h add compare_exchange_val forms

Steve Munroe sjmunroe@us.ibm.com
Tue Apr 15 18:24:00 GMT 2003


Kevin B. Hendricks writes:

> To be completely safe on ppc should all atomic types actually fill
> the entire cache line size of the cpu to prevent two separate atomic 
> types from falling into the same cache line.
>
> If two threads ever compete for them neither may ever get the 
> reservation clearly without the other one clearing it first and we 
> could end up with some sort of strange live-lock situation?

As stated in my previous response there is a danger of "Live Lock" when 
multiple locks share a "reservation unit" (for example a cache line). 

So it is a good idea to avoid arrays of locks. But including a single lock 
as a field in a larger structure is usually OK. Padding locks out to cache 
line size is problematic since you don't know the cache line size at 
compile time.



More information about the Libc-alpha mailing list