Quantcast
Channel: atomic variable also require lock on read-modify-store operation? - Stack Overflow
Viewing all articles
Browse latest Browse all 2

atomic variable also require lock on read-modify-store operation?

$
0
0

I know atomic variable is lock-free!!
It doesn't lock thread, but I have one question..
Read-Modify-Store operation like std::atomic::fetch_add is also executed atomically???
I think this operation isn't just a one instruction.
It need multiple cycle... So If i doesn't lock memory bus ( Actually i don't know if mutex locking contain memory bus lock), Other thread can make memory operation between Read and Store.
So I think it require locking even if atomic variable...

Am i knowing well???


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images