[statechart] Running one scheduler in many threads

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[statechart] Running one scheduler in many threads

Manuel Jung
Hi,

The fifo_scheduler is limited to one execution at a time. I would like a
schedule object, which can handle many processors in many threads at the
same time. Lika a threadpool, where the threads takeover a fsm, when it has
events posted and processes them then. But it should of course only one
thread at a time process events from one machine.
Maybe someone has done this and can show me his code? Or tell me if this is
even possible?

Greetings
Manuel Jung

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: [statechart] Running one scheduler in many threads

Andreas Huber-3
Hi Manuel

> The fifo_scheduler is limited to one execution at a time. I would like a
> schedule object, which can handle many processors in many threads at the
> same time. Lika a threadpool, where the threads takeover a fsm, when it
> has
> events posted and processes them then. But it should of course only one
> thread at a time process events from one machine.

Because of exactly this constraint, I believe such a thread pool servicing a
single state_machine would actually slow down event processing (because of
the locking/signalling overhead; dispatching one event takes a few
microseconds, tops). The only possible advantage I see is with load
balancing. E.g. when you have to limit yourself to e.g. 8 threads servicing
thousands of FSMs, of which only very few are busy processing events at the
same time.

> Maybe someone has done this and can show me his code? Or tell me if this
> is
> even possible?

Everything is possible, but I doubt that such a scheduler is of interest to
many people. Also, it is not exactly the main focus of this library.
fifo_scheduler & friends were always intended as a minimal but working
"example". I hope that a future boost lib will offer types that would render
fifo_scheduler obsolete and maybe offer something like you want.

HTH & Regards,

--
Andreas Huber

When replying by private email, please remove the words spam and trap
from the address shown in the header.


_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users