[Python-3000] the future of the GIL

Greg Ewing greg.ewing at canterbury.ac.nz
Thu May 10 03:08:03 CEST 2007

James Y Knight wrote:

> This just isn't true. Python can do an atomic increment in a fast  
> platform specific way.

The problem with this, from what I've heard, is that
atomic increment instructions tend to be on the order
of 100 times slower than normal memory accesses (I
guess because they have to bypass the cache or do extra
work to keep it consistent).

If that's true, even a single-instruction atomic increment
could be much slower than the currently used instruction
sequence for a Py_INCREF or Py_DECREF.

> It's quite possible the overhead of GIL-less INCREF/DECREF is still  
> too high even with atomic increment/decrement primitives, but AFAICT  
> nobody has actually tried it.

I thought that's what the oft-cited previous attempt was
doing, but maybe not. If not, it could be worth trying
to see what happens.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | Carpe post meridiem!          	  |
Christchurch, New Zealand	   | (I'm not a morning person.)          |
greg.ewing at canterbury.ac.nz	   +--------------------------------------+

More information about the Python-3000 mailing list