Subj : Re: Double-width CAS? To : comp.programming.threads From : SenderX Date : Mon Jan 10 2005 09:39 pm > What is double-width CAS? What is the difference/advantage it has over > CAS? Can you give an example of its usage when it has an advantage over > CAS. http://groups-beta.google.com/group/comp.programming.threads/msg/632b6bdc2a137459 (Note... The consumer side memory barrier is omitted. There should be a read_barrier_depends() after the stacks anchor is read, and before the next pointer is accessed. Instruction ordering wrt the reading of the anchor, the barrier, and accessing the next pointer is critical. I would highly advise you do this in assembly if you decide to test it.) DWCAS gives us the ability to modify a pointer and a word in one straight forward atomic operation. We could use the extra word for an aba counter. Or, an aba counter and a waiters count. Joe Seigh noticed that an aba counter is equivalent to an eventcount, so you could use the extra word for an aba count and a proxy reference count instead of a waiters count. Like this: http://groups-beta.google.com/group/comp.programming.threads/msg/f443b38cf7bbca8a Also, using DWCAS with algorithms that do not use any pointers is portable to all 64-bit processors that have normal CAS or LL/SC. One more thing. DWCAS can be fairly expensive when compared to normal CAS. If performance is of utmost importance, try to use CAS. Or better yet... No atomic operations at all. RCU comes to mind. .