3 ms·
Yes, wait-free is a more precise description of single-writer ring buffer performance. Lock-free queues are not fixed-time, because operations on them involve
by ncmncm 6y ago
Yes, wait-free is a more precise description of single-writer ring buffer performance.
Lock-free queues are not fixed-time, because operations on them involve negotiations on the bus to reclaim the cache line involved, often behind other queued operations.
With the ring buffer, the writer never gives up ownership of the head cache line, and the next one can be pre-fetched (speculatively) because the writes are walking memory sequentially. There is a little hiccup when you wrap around, so it's not absolutely fixed-time.
I put my ring buffers on hugepages so I am not competing for page-map TLB cache.