[Python-Dev] Making the GIL faster & lighter on Windows

Phillip Sitbon phillip.sitbon+python-dev at gmail.com
Tue May 26 23:45:57 CEST 2009


> FWIW, Win32 CriticalSections are guaranteed to be fair, but they don't
> guarantee a defined order of wakeup among threads of equal priority.

Indeed, I should have quoted the MSDN docs:

"The threads of a single process can use a critical section object for
mutual-exclusion synchronization. There is no guarantee about the
order in which threads will obtain ownership of the critical section,
however, the system will be fair to all threads."

http://msdn.microsoft.com/en-us/library/ms683472(VS.85).aspx

I read somewhere else that the FIFO order is present, but obviously we
shouldn't to expect that if it's not documented as such.

> According to a past discussion on this list, the current implementation isn't:
> http://mail.python.org/pipermail/python-dev/2008-March/077814.html
> (at least on the poster's system)
>

I believe he's only talking about Linux. Apples & oranges when it
comes to stuff like this, although it still justifies looking into
what happens every _Py_CheckInterval on Windows.

- Phillip


More information about the Python-Dev mailing list