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".
N
running threads and one synchronized workqueue (using pthread
mutex).int
).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...)
TBB 4 provides a concurrent_priority_queue (search 'priority' in the reference manual). Furthermore, using TBB is nice if you can design your program with tasks, not threads, in mind. Indeed, it provides a lot of stuff to describe dependancies between tasks. Also, TBB seems to be fairly portable if it's important for you.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With