pthread_create(3) and memory synchronization guarantee in SMP architectures

后端 未结 3 1882
忘了有多久
忘了有多久 2021-01-07 10:05

I am looking at the section 4.11 of The Open Group Base Specifications Issue 7 (IEEE Std 1003.1, 2013 Edition), section 4.11 document, which spells out the memory synchroniz

3条回答
  •  时光说笑
    2021-01-07 10:56

    cache coherent architectures guarantee from the architectural design point of view that even separated CPUs (ccNUMA - cache coherent Not Uniform Memory Architecture), with independent memory channels when accessing a memory location will not incur in the incoherency you are describing in the example.

    This happens with an important penalty, but the application will function correctly.

    Thread #1 runs on CPU0, and hold the object memory in cache L1. When thread #2 on CPU1 read the same memory address (or more exactly: the same cache line - look for false sharing for more info), it forces a cache miss on CPU0 before loading that cache line.

提交回复
热议问题