4 ms·
Do threads pass data among themselves? Use blocking queues whose capacity is a function of the max amount of data that can potentially be waiting without exhaus
by sillysaurus3 10y ago
Do threads pass data among themselves? Use blocking queues whose capacity is a function of the max amount of data that can potentially be waiting without exhausting the memory.
I.e. a ringbuffer. The Disruptor is an efficient and simple way to coordinate this. https://lmax-exchange.github.io/disruptor/ https://lmax-exchange.github.io/disruptor/
- brianwawok 10y agoDisruptor is nonblocking. I think the OP is talking about actual blocking queues which are generally bad in high performance code.
- sillysaurus3 10y agoDisruptor blocks when the ringbuffer fills up.
- brianwawok 10y agoTouchè. Most people size it large enough to never block on insert, so it is usually considered a non-blocking queue. Reads never block for example.