Boost logo

Boost :

Subject: Re: [boost] [threadpool] new version v12
From: Michael Marcin (mike.marcin_at_[hidden])
Date: 2008-11-03 12:01:55


k-oli_at_[hidden] wrote:
> Am Samstag, 1. November 2008 00:53:11 schrieb Michael Marcin:
>> k-oli_at_[hidden] 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

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