Search code examples
cachingmulticoreshared-memory

Can processor cores thrash each other's caches?


If more than one core on a processor is accessing the same memory address, will they thrash each other's caches or will some snooping protocol allow each to keep the data in L1-cache?

I am interested in a general answer as well as answers for specific processors. How many layers of cache are invalidated? Will accessing another address within the same cache-line invalidate the entire line? What can you do to alleviate these problems?


Solution

  • http://en.wikipedia.org/wiki/File:Dual_Core_Generic.svg implies that each core has its own (private/independent) L1 cache.

    But this does not mean that a cache-line couldn't be duplicated, at the expense of taking up twice as much space.

    I think you're asking, "If one core writes to a memory address which the other core has cached, does that invalidate/flush/trash the other core's cache?"

    This article says that there are various/several types of snooping protocol (which implies that the answer to your question is CPU-specific). You can also Google for multicore cache coherence.