[Python-Dev] Removing the GIL (Me, not you!) (original) (raw)

Justin Tulloss tulloss2 at uiuc.edu
Fri Sep 14 07:10:34 CEST 2007


On 9/13/07, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:

Jason Orendorff wrote: > The clever bit is that SpiderMonkey's per-object > locking does not require a context switch or even an atomic > instruction, in the usual case where an object is not shared among > threads. How does it tell whether an object is shared between threads? That sounds like the really clever bit to me.

If you look at the article, they have a code sample.

Basically a global is "owned" by the first thread that touches it. That thread can do whatever it wants with that global. If another thread wants to touch the global, it locks everything to do so.

This is a pretty good idea except that in Python there are so many globals that all threads benefit from having access to. Luckily, except for their reference counts, they're mostly read-only. Therefore, if we can work out this reference count, we can probably use a similar concept.

Justin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-dev/attachments/20070914/53f674b4/attachment.htm



More information about the Python-Dev mailing list