Why is CompareAndSwap instruction considered expensive?

Posted by eyalw on Stack Overflow See other posts from Stack Overflow or by eyalw
Published on 2010-06-04T08:02:01Z Indexed on 2010/06/09 21:02 UTC
Read the original article Hit count: 142

Why is CompareAndSwap instruction considered expensive?

I read in a book:

"Memory barriers are expensive, about as expensive as an atomic compareAndSet() instruction."

Thanks!

© Stack Overflow or respective owner

Related posts about multithreading

Related posts about synchronization