[Python-Dev] Reworking the GIL

Kristján Valur Jónsson kristjan at ccpgames.com
Mon Oct 26 15:09:43 CET 2009



> -----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 Sturla Molden
> time.sleep should generate a priority request to re-acquire the GIL;
> and
> so should all other blocking standard library functions with a time-
> out.

I don't agree.  You have to be very careful with priority.  time.sleep() does not promise to wake up in any timely manner, and neither do the timeout functions.  Rather, the timeout is a way to prevent infinite wait.

In my experience (from stackless python) using priority wakeup for IO can result in very erratic scheduling when there is much IO going on, every IO trumping another.  You should stick to round robin except for very special and carefully analysed cases.
K


More information about the Python-Dev mailing list