Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

concurrent write to same memory address

If two threads try to write to the same address at the same time, is the value after the concurrent write guaranteed to be one of the values that the threads tried to write? or is it possible to get a combination of the bits?

Also, is it possible for another thread to read the memory address while the bits are in an unstable state?

I guess what the question boils down to is if a read or write to a single memory address is atomic at the hardware level.

like image 458
Mark Avatar asked Nov 21 '09 20:11

Mark


1 Answers

I think this all depends on the "memory model" for your particular programming language or system.

like image 166
Brian Avatar answered Sep 22 '22 04:09

Brian