9 ms·
https://rigtorp.se/ringbuffer/ https://rigtorp.se/ringbuffer/, from a comment below, answered my question. In rough terms, every push or pop from the queue als
by anthomtb 4y ago
https://rigtorp.se/ringbuffer/ https://rigtorp.se/ringbuffer/, from a comment below, answered my question.
In rough terms, every push or pop from the queue also causes head or tail to be written, thus dirtying a line of cache. That’s the bit I misunderstood.
- binarycoffee 4y agoTo be clear, as mentioned in another thread [0] there is no need to ensure consistency between head and tail for a SPSC so storing them in different cache lines would be much better. For the multiple-consumer variant, however, consistency between head and tail is required so packing them in the same atomic is the simplest solution. [0] https://news.ycombinator.com/item?id=31386741 https://news.ycombinator.com/item?id=31386741