Talk:Compare-and-swap

From Wikipedia, the free encyclopedia

"Maurice Herlihy (1993) proved that fetch-and-add is inferior to compare-and-swap." This should not be the only reason for merge. Although the FAA operation might be inferior in the context of lock free algorithms it still is a locking primitive and it's usage should be shown (somewhere). --Jyke 11:13, 26 August 2005 (UTC)


Further, Fich, Hendler and Shavit [1] have shown that, in terms of memory usage, compare-and-swap can be weaker than fetch-and-add. Implementing fetch-and-add wait-free from compare-and-swap requires at least as many memory locations as threads. Implementing fetch-and-add wait-free from fetch-and-add requires only one. --Chris Purcell 12:02, 11 October 2005 (UTC)

[edit] Is this three way merge really necessary?

It looks like these are all distict primitives for atomic synchronization. While they each have advantages and disadvantages, they are distinct. If there is really so much overlap, then we should merge all these articles into a single article on "Hardware Synchronization Primitives" or something like that. (But that article would probably be too big, and would get split into articles like these at some point...) Jamie 01:21, 14 November 2005 (UTC)

I would agree: there doesn't seem to be any real point to merging. Chris Purcell 11:35, 14 November 2005 (UTC)

I agree too : there doesn't seem to be any real point to merging or a very good operating system writer would have to rewrite it completly . TheCric 11:35, 14 February 2006 (UTC)

[edit] CAS useful on uniprocessor systems as well

The article mentions that CAS is only used on multiprocessor systems. It is currently used on uniprocessor systems for user-space applications where disabling the interrupt is not allowed directly and invoking the OS kernel is quite expensive. Catalin 13:54, 12 April 2007 (UTC)

I added a comment about this. --JeffreyYasskin (talk) 18:45, 16 December 2007 (UTC)

[edit] CAS is both an abstraction and an assembly instruction

Both C++0x [2] and Java [3] use CAS as the name for an atomic operation on data of various sizes, including larger than a single pointer. On the other hand, the assembly instruction is only reliably available on data sizes up to the pointer size. I'd like to point out the ambiguity in the text, but I'm not sure of the best wording to use. --JeffreyYasskin (talk) 18:45, 16 December 2007 (UTC)