l*********8 发帖数: 4642 | 1 http://wiki.python.org/moin/GlobalInterpreterLock
上面说CPython用的GIL degrades performance.
所以我们使用CPython要避免多线程? |
d***q 发帖数: 1119 | 2 yep...thread implementation of python 2.x sucks..so try to avoid threads.
use multi process for cpu intensive tasks
and async IO or coroutine for io tasks. |
l*********8 发帖数: 4642 | 3 Thanks!
And GIL is still there in CPython 3.1. I hope the problem will be solved
soon.
【在 d***q 的大作中提到】 : yep...thread implementation of python 2.x sucks..so try to avoid threads. : use multi process for cpu intensive tasks : and async IO or coroutine for io tasks.
|
p**o 发帖数: 3409 | 4 GIL in CPython is likely to exist forever.
积重难返
【在 l*********8 的大作中提到】 : Thanks! : And GIL is still there in CPython 3.1. I hope the problem will be solved : soon.
|
d***q 发帖数: 1119 | 5
Because python use reference-counting so it would be quite hard to remove
GIL completely.
If you are really care about this issue there are two options:
1: you may try pypy & its experimental module: STM it is said that STM has
already worked with multi cores directly. However it is far away from
production usage.
2: use other implementations like Jython, IronPython or event other
languages..
【在 l*********8 的大作中提到】 : Thanks! : And GIL is still there in CPython 3.1. I hope the problem will be solved : soon.
|