[Python-Dev] Pythonic concurrency - cooperative MT (original) (raw)

Simon Wittber simonwittber at gmail.com
Fri Sep 30 16:32:55 CEST 2005


On 9/30/05, Antoine Pitrou <solipsis at pitrou.net> wrote:

> (C) That scheduler is non-preemptive. A single > greedy generator can starve all the others. Instead of looking at this as a problem, you could look at it as a feature. Since generators can't be switched at arbitrary places, the programmer has to define his/her synchronization points explicitly.

I use this approach extensively, using tasks which are defined using generators. The scheduler I developed for this can be viewed here:

http://metaplay.dyndns.org:82/svn/nanothreads/nanothreads.py

Synchronization using yield statements is an important feature, as I use these cooperative threads for game development. These threads are very useful for games, as they have very low overhead, and allow the programmer to exercise more control over their execution.

Sw.



More information about the Python-Dev mailing list