We are considering which parallel framework for C/C++ to use. We have some very special conditions and are not 100% sure, that e.g. TBB can add something “more”.
- There are
Nrunning threads and one synchronized workqueue (usingpthreadmutex). - Our jobs are prioritized (
int). - Jobs are put into the queue and idle thread takes a job with the highest priority.
This repeats until the queue is empty.
Well, and now, I’d like to know if some framework like TBB (Thread Building Blocks) can offer more for this special scenario from the algorithmic point of view?? (So, internals…)
In my opinion you could gain by replacing the heavy mutex with something more robust, like the spin_rw_mutex: http://threadingbuildingblocks.org/files/documentation/a00163.html. Since most likely insertion/removal operations are fast, you could benefit more from a non-blocking lock.