Boost logo

Boost :

Subject: Re: [boost] [lockfree] Faster ring-buffer queue implementation
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2014-01-15 23:04:31


On 16/01/2014 07:32, Quoth Alexander Krizhanovsky:
> Otherwise I'm wondering if it has sense to integrate the queue
> implementation into boost::lockfree?
>
> The algorithm description is available at
> http://www.linuxjournal.com/content/lock-free-multi-producer-multi-consumer-queue-ring-buffer

I've only had a quick glance at it, but it looks less general-purpose --
it appears that for each queue instance, you need to predefine an upper
bound on the number of producer and consumer threads and assign each
thread a unique id within that bound.

(Also, given the apparent locality of the thread-id, I don't like that
it is stored and accessed as a thread-global; this would complicate use
of multiple queues from one thread. And interleaving the per-thread
head/tail indexes seems vulnerable to false sharing.)

There are still many cases where manually assigning thread ids is
achievable, so something like this might be useful to have. But it
couldn't be a replacement for the more general queue.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk