Generator-based microthreads and games

neokosmos at gmail.com neokosmos at gmail.com
Thu Aug 10 22:54:31 EDT 2006


I've seen various generator-based microthread implementations online,
but I've been wondering: has anyone used microthreads in this manner in
a game environment?  Note, I am emphatically *not* referring to
Stackless, which I know has been used in a production game environment;
this post is referring strictly to the standard Python interpreter, (v.
2.4 or 2.5 as you wish).

I intend to try a little cooperative microthreading implementation in
my game server to avoid threading issues and possibly simplify the
programming model.  This seems particularly attractive given the
enhancements Python 2.5 brings to generators.

If anyone else has tried this, what I would like to know is this:

* How many microthreads were you able to run concurrently with decent
performance?
* How much computation is feasible to carry out in a microthread?
(Certainly, this goes hand in hand with the previous question, of
course.)
* What sort of scheduler did you use?
* Was it worth it?  By "worth it," I mean in terms of performance and
ease of implementation.

I'll no doubt have further questions later after I actually begin
implementing this stuff, but I suppose that will do for now.

Thanks!




More information about the Python-list mailing list