New Contributor II
06-22-2009 04:11 AM
no, TBB does not have a leader/followers pattern implemented, and, unfortunately, tasks and I/O do not mix very well. The support for I/O that TBB currently has is a tbb_thread wrapper around native threads API. However tbb_thread is a portable solution and you could implement leader/followers pattern on the side of your application.
06-22-2009 11:51 AM
Thank you so much for the quick reply.
But does it means that TBB is not indicated (efficient) to process I/O (networking, fo example) ?
Thanks again for any tip!
06-23-2009 12:30 PM
TBB tasks are executed by threads. If a task has a blocking I/O call, it will block the thread executing it, leading to CPU under-utilization despite other tasks available for execution. In some cases, due to some TBB task scheduler implementation details, it may lead to progress being blocked for task trees that donot directly depend on the task waiting for I/O. In some cases, it may lead to idle-spinning of other threads. So basically TBB tasks may use I/O, though with the price of possible suboptimal work.
06-23-2009 01:09 PM
In my opinion, TBB pipeline more or less fits the pattern for what they call "unbound thread-handle association". For the case where an event should be processed by a particular thread that earlier took care of its predecessor, there is no ready solution.