Boost logo

Boost :

Subject: Re: [boost] inter thread communication with message queues
From: Bjorn Reese (breese_at_[hidden])
Date: 2014-01-25 06:02:29


On 01/24/2014 04:05 PM, Kenneth Adam Miller wrote:

> +--------------------------------------------------------------------+
> | |
> v |
> Pool A RR Thread Set 1 Router X |
> PULL-PUSH --==> PULL-read-PUSH ==--> PULL-PUSH --==> PULL Thread Set 2 PUSH
> \ /
> +-compress-+
> Pool B RR / \
> PULL-PUSH --==> PULL PUSH
> ^ ||
> | ||
> +----------- PUSH-write-PULL <--==++
> Pool C
>
>
> Questions: how do I have a separate thread poll on multiple shared message
> queues? Like, I have a thread pool that both receives requests for buffer
> handles and that receives old buffer handles to recycle.

Your architecture looks a like a case of premature optimization.

I suggest that you use the Leader/Followers design pattern [1] instead.
You have just one thread pool and let each thread perform operation A,
B, and C before it returns to recycle the buffer and wait for the next
task. This way you can avoid several queue and thread context-switches.

[1] http://www.cs.wustl.edu/~schmidt/PDF/lf.pdf


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