Threads em python  XML
Índice dos Fóruns » Outras Linguagens
Autor Mensagem
rodrigo.bossini
GUJ Master
[Avatar]

Membro desde: 01/07/2008 20:59:17
Mensagens: 1055
Offline

Trecho do Head First Python:
"
Threads do indeed exist in Python but should be avoided where possible.
This has nothing to do with the quality of Python?s threading library and
everything to do with Python?s implementation, especially the implementation
known as CPython (which is more than likely the one you?re running
now). Python is implemented using a technology known as the Global
Interpreter Lock (GIL), which enforces a restriction that Python can only
ever run on a single interpreter process, even in the presence of multiple
processors. What all this means to you is that your beautifully designed and implemented
program that uses threads will never run faster on multiple processors even
if they exist, because it can?t use them. Your threaded application will run
serially and, in many cases, run considerably slower than if you had developed
the same functionality without resorting to threads. Main message: don?t use threads with Python until the GIL restriction is
removed?if it ever is."

Isso quer dizer que somente se usa threads em python quando a aplicação tem tanto atividades IO-Bound quanto CPU-Bound?

http://www.rodrigobossini.com.br/

Meu Twitter:@rodrigobossini
Se uma pessoa fala português há 30 anos e ainda não aprendeu, por que é que vou acreditar que ela está programando em alguma linguagem de programação há apenas 10 anos e sabe o que está fazendo?
entanglement
GUJ Hacker

Membro desde: 26/09/2009 09:18:56
Mensagens: 5750
Offline

Você pode usar Jython ou IronPython para remover esse problema.

http://en.wikipedia.org/wiki/Global_Interpreter_Lock
 
Índice dos Fóruns » Outras Linguagens
Ir para:   
Powered by JForum 2.1.8 © JForum Team