Python 3.2-GIL-好/不好? [英] Python 3.2 - GIL - good/bad?
问题描述
Python 3.2 ALPHA 已出 .
Python 3.2 ALPHA is out.
从更改日志看来,GIL已被完全重写.
From the Change Log, it appears the GIL has been entirely rewritten.
几个问题:
- GIL好还是不好? (和 为什么).
- 新GIL更好吗?如果可以,怎么办?
- Is having a GIL good or bad? (and why).
- Is the new GIL better? If so, how?
更新:
我是Python的新手.因此,所有这些对我来说都是新手,但我至少了解,使用CPython的GIL的存在是很重要的.
I'm fairly new to Python. So all of this is new to my but I do at least understand that the existence of a GIL with CPython is a huge deal.
但是,问题是,为什么CPython不仅像Perl一样克隆了解释器,以消除对GIL的需求?
Question though, why does CPython not just clone the interpreter like Perl does in an attempt to remove the need for the GIL?
推荐答案
关于GIL为何烂掉的最佳解释是:
The best explanation I've seen as to why the GIL sucks is here:
http://www.dabeaz.com/python/GIL.pdf
同一个人在此处介绍了有关新GIL的演示文稿:
And the same guy has a presentation on the new GIL here:
http://www.dabeaz.com/python/NewGIL.pdf
如果已完成所有操作,那么它仍然很糟糕-没那么糟糕.多个线程将表现得更好.多核仍然无法通过单个python应用程序为您做任何事情.
If that's all that's been done it still sucks - just not as bad. Multiple threads will behave better. Multi-core will still do nothing for you with a single python app.
这篇关于Python 3.2-GIL-好/不好?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!