14 ms·
>Perhaps most surprisingly, this includes even the case of potentially concurrent writes of the same value by different threads. Can someone explain to me how
by swagmoney1606 2y ago
>Perhaps most surprisingly, this includes even the case of potentially concurrent writes of the same value by different threads.
Can someone explain to me how this is possible?
- kccqzy 2y agoGo read section 2.4.
- iracigt 2y agoSection 2.4 gives a concrete example, though there are some asterisks. The example is one where a compiler rewrites something like `while (...) x++;` to put `x` in a register: `int reg = x; while (...) reg++; x = reg`. The author reports this is an optimization GCC was observed doing, and means you can have a read-writeback even when the while condition is false to begin with. If this optimization appears interleaved with identical writes then you have problems.