Boost logo

Boost :

Subject: Re: [boost] [stratified] library for micro-/userland-threads
From: Oliver Kowalke (oliver.kowalke_at_[hidden])
Date: 2012-07-03 05:04:06


> Just for clarification, how is stratified related to your proposed
> coroutine library?

Some additional notes:

I would use a coroutine in order problems related to multiple enter/leave of functions and preserving state of local data. I've added some examples in coroutine/example directory (for instance fringe problem).
Nat Goodspeed has showed a good example how a coroutine could be used in its C++ Now! 2012 paper.

A stratum/fiber could be used for sub-tasks in threadpools. In order to solve the split-and-join problem, boost.task transforms sub-taks into stra/fibers and let them cooperativly sheduled and migrated between the threads of the threadpool. In such scenario you usally do not need a coroutine because you pass the arguments if you create the task (whic hwill be passed to the threadpool) and the result is transfered via future (excpetions too). Second you need some synch. primitves to coordinate your sub-tasks. therefore I think coroutines are not the best choise for threadpools (of course you could use coroutines to implement fibers/context swapping, but this is already abstracted by boost.context). With strat/fibers I don't have to pay for coroutine args, returns value and coroutine::self_t.

roughly, thats my opinion how coroutines and strata/fibers differ.

regards,
Oliver


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