[Python-Dev] Removing the GIL (Me, not you!)
Justin Tulloss
tulloss2 at uiuc.edu
Thu Sep 13 22:16:57 CEST 2007
On 9/13/07, Jason Orendorff <jason.orendorff at gmail.com> wrote:
>
> On 9/13/07, Justin Tulloss <tulloss2 at uiuc.edu> wrote:
> > 1. Use message passing and transactions. [...]
> > 2. Do it perl style. [...]
> > 3. Come up with an elegant way of handling multiple python processes.
> [...]
> > 4. Remove the GIL, use transactions for python objects, [...]
>
> The SpiderMonkey JavaScript engine takes a very different approach,
> described here:
> http://developer.mozilla.org/en/docs/SpiderMonkey_Internals:_Thread_Safety
This is basically the same as what perl does, as far as I understand it.
There are differences, but they're not that substantial. It's basically the
idea of keeping all state separate and treating global access as a special
case. I think this is a pretty solid approach, since globals shouldn't be
accessed that often. What we would want to do differently is make sure that
read-only globals can be cheaply accessed from any thread. Otherwise we lose
the performance benefit of having them in the first place.
Refcounting is another major issue. SpiderMonkey uses GC instead.
> CPython would need to do atomic increfs/decrefs. (Deferred
> refcounting could mitigate the cost.)
This is definitely something to think about. I don't really have an answer
straight off, but there are several things we could try.
The main drawback (aside from the amount of work) is the patent.
> SpiderMonkey's license grants a worldwide, royalty-free license, but
> not under the Python license. I think this could be wrangled, if the
> technical approach looks worthwhile.
I'm not sure this is an issue. It's not like we would be using the code,
just the patented algorithm. Any code we wrote to implement the algorithm
would of course be covered under the python license. I'm not a legal guy
though.
Justin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20070913/3ea47b36/attachment.htm
More information about the Python-Dev
mailing list