Message98168
| Author |
lemburg |
| Recipients |
brian.curtin, jnoller, kevinwatters, lemburg, nascheme, pitrou, rcohen, schmir |
| Date |
2010年01月22日.20:42:28 |
| SpamBayes Score |
1.0757886e-06 |
| Marked as misclassified |
No |
| Message-id |
<4B5A0DB3.6090301@egenix.com> |
| In-reply-to |
<1264192046.3526.53.camel@localhost> |
| Content |
Antoine Pitrou wrote:
>> Perhaps I'm missing some feature of the new GIL. Is there some
>> documentation for it somewhere ?
>
> Almost nothing besides what is found in ceval_gil.h and in the following
> thread:
> http://mail.python.org/pipermail/python-dev/2009-October/093321.html
> Dave Beazley did a high-level presentation about it:
> http://www.dabeaz.com/python/NewGIL.pdf
Thanks. Dave's slides help a lot. The logic certainly sounds like
a major improvement !
>>> Well, if you don't use any threads you don't have to change the setting
>>> in the first place :-). You might want to do it in order to
>>> "micro-optimize" your app (i.e. save 1-2% on CPU-bound code), but this
>>> is unnecessary with the new GIL, since the interval is ignored when
>>> there's only one thread running.
>>
>> Hmm, how do you determine that only one thread is running ?
>
> Actually, I don't determine it, it's a side effect of how the GIL is
> implemented. If no thread is waiting for the GIL, the main thread isn't
> "asked" to drop it.
>
>> What if an extension uses threads that are not under Python
>> control, e.g. when embedding the JVM or when using a CORBA
>> ORB ?
>
> These don't wait for the GIL, hopefully :-)
Well, they might call back into Python, but I guess that's not
supported anyway, not even in 2.x, since such a thread wouldn't
have a properly setup Python thread state. |
|