June 15, 2006
Lock-free Interprocess CommunicationAlgorithm Three (Cache Line Optimized Light Pipe)
In the aforementioned mechanism there are a few performance problems. One of them is cache trashing (false sharing) which can occur when Writer and Reader are writing to the same cache line (see [1] for more details about false sharing). In this case the cache synchronization mechanism will need to pass written data inside the same cache line a few times between processor caches. To avoid this behaviour the above mechanism needs to be updated:
This update will change the behaviour of Reader in such a way that it postpones writing back any zero-valued words to the cache line until the whole line is read. It writes zero values backwards from the end of the cache line deliberately to avoid the situation when Writer starts writing into the cache line before it is completely cleared with zero values by Reader.
|
|
||||||||||||||||||||||||||||||
|
|
|
|