If I make a piece of code in which each thread modifies completely different parts of an array, will that maintain cache coherency?
问题 So I am making some parallel code using OpenMP (but this question should be reasonably applicable to other frameworks), in which I have an array of objects: std::vector<Body> bodies; And then I do a little parallel loop to do some things to the bodies . At the start of this parallel section, a team of threads is set up to execute the loop individually. The loop basically uses the values of foo on every Body (apart from the one in question) to update the value of bar on the body in question.