Talk:False sharing

Rewrite
This article needed a total rewrite, and even though I'm only about half done, I think that it's still quite a bit improved. I plan to use make an example with shared ring buffers since that problem is probably the most widespread in reality, but I've not yet determined how to be both correct and succinct with that yet. In the long run, there should probably be an diagram, but I have absolutely no skill at that. Also, it would be nice if there were articles on processor interconnects or memory stalls that I could link to. Jts888 (talk) 05:20, 20 July 2008 (UTC)

False sharing example
Wasn't the example on my original post good enough to see a "false sharing" effect in action? —Preceding unsigned comment added by Kalman5 (talk • contribs) 14:42, 2 September 2008 (UTC)

The original example conveyed the right idea but was a little ambiguous in explaining the internal mechanism. It should be made explicit that false sharing can occur even if one process is only reading. Reciprocal thrashing is obviously an even worse condition, but it is not the most fundamental case. 00:42, 31 October 2008 (UTC)

The example code and out is just bad. Not units on the output, it remains absolute unclear what the output is. One needs to dig deep in the overly complex C++ 20 code to understand what the output is and what the program does. It seem the program doesn't only benchmark false sharing, but also reading, incrementing and writing back. A more minimalisit example, that truely benchmarks the cache coherency overhead of the false sharing would just be storing data, not reading. But maybe I'm understanind the program wrong :) False sharing is about writing to the same cache line, not reading. The article is not very well written, and needs improvement in general, best would be a re-write from scratch. In general I think wikipedia is not the place for C++ benchmarking code, in particular not if it requires the latest compilers and language features that only a small number of people have access to or understand. This is not educational. — Preceding unsigned comment added by 24.9.63.172 (talk) 19:30, 25 February 2023 (UTC)

It doesn't even compile https://godbolt.org/z/TxvTa7Kqf — Preceding unsigned comment added by 24.9.63.172 (talk) 20:41, 25 February 2023 (UTC)

Mitigation
"However, some of these transformations may not always be allowed. For instance, the C++ programming language standard draft of C++23 mandates that data members must be laid out so that later members have higher addresses." Isn't this always true in C/C++ structures and classes? However, false sharing is not an effect of a particular programming language and as such I think this article shouldn't specialize on a specific one. — Preceding unsigned comment added by 24.9.63.172 (talk) 20:26, 25 February 2023 (UTC)

Bad reference
The Dr Dobbs reference appears to be broken. The link works, but the target page is broken. Csgehman (talk) 05:16, 25 May 2023 (UTC)