Python 3.2-GIL-好/不好? [英] Python 3.2 - GIL - good/bad?

查看:109
本文介绍了Python 3.2-GIL-好/不好?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Python 3.2 ALPHA 已出 .

Python 3.2 ALPHA is out.

从更改日志看来,GIL已被完全重写.

From the Change Log, it appears the GIL has been entirely rewritten.

几个问题:

  1. GIL好还是不好? (和 为什么).
  2. 新GIL更好吗?如果可以,怎么办?
  1. Is having a GIL good or bad? (and why).
  2. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆