Why is CompareAndSwap instruction considered expensive? - by eyalw Why is CompareAndSwap instruction considered expensive? I read in a book: "Memory barriers are expensive, about as expensive as an atomic compareAndSet() instruction." Thanks! Read the article