just curious to know which CPU architectures support compare and swap atomic primitives?
Starting with the ARMv6 architecture ARM has the LDREX/STREX instructions that can be used to implement an atomic compare-exchange operation.