Can I force cache coherency on a multicore x86 CPU?

后端 未结 9 1112
一个人的身影
一个人的身影 2020-11-29 18:43

The other week, I wrote a little thread class and a one-way message pipe to allow communication between threads (two pipes per thread, obviously, for bidirectional communica

9条回答
  •  渐次进展
    2020-11-29 19:12

    Herb Sutter seemed to simply suggest that any two variables should reside on separate cache lines. He does this in his concurrent queue with padding between his locks and node pointers.

    Edit: If you're using the Intel compiler or GCC, you can use the atomic builtins, which seem to do their best to preempt the cache when possible.

提交回复
热议问题