3 ms·
the best way to prevent false sharing is by making it so that no two threads are in a position to access the same data structure which may be inconsistent becau
by teravor 3mo ago
the best way to prevent false sharing is by making it so that no two threads are in a position to access the same data structure which may be inconsistent because it is being written to. embrace message passing.
- nh2 3mo agoNo. False sharing can happen even with only 1 writer.
- wongarsu 3mo agoGP's claim does not require two writers for false sharing. It requires two threads with either read or write access, at least of which is writing The valid criticism is that message passing also fits that definition. But assuming good faith, the implied argument seems to be "use an off-the-shelf message passing solution that already solves all this, rather than rolling your application-specific data sharing"
- IshKebab 3mo agoMessage passing is definitely a good solution in many cases, but shared data structures are often significantly faster. Even Go doesn't restrict you to message passing, even though it is very focused on channels.
- boricj 3mo agoSome of us work with industrial SoCs, with puny in-order Cortex-A7 cores and tiny L1/L2 caches. Sometimes, you really need to optimize for the hardware and micro-architecture you have in order to hit the performance goals required and message passing isn't always the answer.