Boost logo

Boost :

Subject: Re: [boost] [threadpool] new version v12
From: k-oli_at_[hidden]
Date: 2008-11-02 03:30:33


Am Sonntag, 2. November 2008 00:03:44 schrieb Anthony Williams:
> > The idea behind using fiber inside a threadpool is, that each
> > worker-thread executes multiple fibers - fiber would yield its execution
> > if future::get() would block (because future is not ready)
>
> Exactly. That's what my prototype does too. My point is that you can
> do this without fibers too, but you might run out of stack.

Interessting - I'd like to see how the code works. Is it possible to access
your prototype?

> One thing you can do with fibers that you can't easily do with a
> single stack is switch back to the parent task when the nested task
> blocks. Doing so allows you to run *other* tasks from the pool if a
> thread blocks and the task it is waiting for is already running
> elsewhere. You can also migrate tasks between threads.

That's the way boost.threadpool uses boost.fiber (but fibers are not exchanged
between worker-threads -> work-stealing is done only on un-fibered tasks
waiting in the local queue of a worker-thread).

> Doing either of these requires that the task is prepared for it.

in which sense (sorry I'm not aware of)

> Anthony

regards,
Oliver


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