
Sebastian Sylvan wrote:
For correctness, maybe not, for efficiency, yes definitely!
In theory, decades of research and engineering went into shared memory on common hardware, so it should be faster. In practice, you give shared memory to spoiled kids (and seldom encourage them to use other paradigms), and they have no incentive to decompose their problems. They just gratuitously share all variables and therefore need to lock everything. So it becomes slower. If you think hard to decompose a problem, several possibilities occur: - Some problems need shared memory badly. - Most other problems need sharing so little that the way you use shared memory ends up simulating message passing. I encourage you to re-think how often your problems land in the second case. Because we are all spoiled by shared memory, it may be hard to notice.