[Python-Dev] "Fixing" the new GIL

Kristján Valur Jónsson kristjan at ccpgames.com
Tue Mar 16 18:02:13 CET 2010



> -----Original Message-----
> From: python-dev-bounces+kristjan=ccpgames.com at python.org
> [mailto:python-dev-bounces+kristjan=ccpgames.com at python.org] On Behalf
> Of Antoine Pitrou
> > The key to this
> > is implementing your GIL in such a way that you (and not the system)
> > chooses which threads runs next.  On Windows it works in a nice,
> > determinitstic FIFO order becoause that's how the underlying Event
> > object is supposed to work.
> 
> Well, I don't think this has ever been by design, and it's not obvious
> this is desirable either (see Dave Beazley's benchmark).
>
Did Dave benchmark a straight FIFO system?
I can tell you out of experience, engineering a similar system (stacklessIO) that you _do_ want a deterministic scheduling algorithm.  The most straightforward is round-robin (or FIFO), and the only sane option really if you know nothing about your threads.  Upon this, you can start to build, by for example adding another priority layer, but you have to have a solid foundation.  We have never had high priority for IO threads in python (and its not-by-design round robin scheduler on single core cpus) and it is unclear why that should be required now as a fix.

 
> > Btw, if you want to take up a private converstaion with me, I'd like
> > to point out to you some problems with the Windows version of the
> > Condition variable :)
> 
> You can report a bug.
Or I could commit a fix.  I just thought You might be interested, is all.  I'll submit a patch.

K


More information about the Python-Dev mailing list