
k-oli@gmx.de wrote:
Am Samstag, 1. November 2008 00:53:11 schrieb Michael Marcin:
k-oli@gmx.de wrote:
Hello,
the new version of Boost.Threadpool depends on Boost.Fiber. Forgive my ignorance but http://tinyurl.com/6r3l6u claims that "fibers do not provide advantages over a well-designed multithreaded application".
What are the benefits of using them in a threadpool?
Thanks,
Hello Michael,
using fibers in a threadpool enables fork/join semantics (algorithms which recursively splitt an action into smaller sub-actions; forking the sub-actions into separate worker threads, so that they run in parallel on multiple cores)
For instance the recursive calculation of fibonacci numbers (I know it is not the best algorithm for fibonacci calculation):
<snip example code>
Since the parent task can't complete any work until all of the child tasks complete it seems to me that one of the children should be directly run in the same context as the parent without needing the overhead of the scheduler. It's convenient that you chose this example. TBB uses this same example in their tutorial pdf ( http://tinyurl.com/64ejvp ) in chapter 10.2. Perhaps you could compare and contrast your solution which uses fibers with theirs. Thanks, -- Michael Marcin