2 ms·
> * .. .you just mean that the O state doesn't ping-pong between cores?* Correct. My terminology was sloppy, sorry. I have no experience of this "context switc
by ncmncm 6y ago
> * .. .you just mean that the O state doesn't ping-pong between cores?*
Correct. My terminology was sloppy, sorry. I have no experience of this "context switch" you speak of; my processes are pinned and don't do system calls or get interrupted. :-)
The writing core retains ownership of the cache lines, so no expensive negotiation with other caches occurs. When the writer writes, corresponding cache lines for other cores get invalidated, and when a reader reads, that core's cache requests a current copy of the writer's cache line.
The reader can poll its own cache line as frequently as it likes without generating bus congestion, because no invalidation comes in until a write happens.
There is a newish Intel instruction that just sleeps waiting for a cache line to be invalidated, that doesn't compete for execution resources with the other hyperthread, or burn watts. Of course compilers don't know it. I don't know if AMD has adopted it, but would like to know; I don't recall its name.