[Cascavel-pm] threads e uso de CPU

Nilson Santos Figueiredo Jr. acid06 em gmail.com
Quinta Dezembro 10 00:43:11 PST 2009


2009/12/10 Alceu Rodrigues de Freitas Junior <glasswalk3r em yahoo.com.br>:
> Ops... eu tenho coisas demais em memória para fazer cópias para todas as
> threads instanciadas.
>
> Eu usei essa documentação aqui como referência:
>
> "The biggest difference between Perl ithreads and the old 5.005 style
> threading, or for that matter, to most other threading systems out there, is
> that by default, no data is shared. When a new perl thread is created, all
> the data associated with the current thread is copied to the new thread, and
> is subsequently private to that new thread!" --
> http://www.mathematik.uni-ulm.de/help/perl5/doc/perlthrtut.html
>
> Se faço elas shared, não tem cópia!
> Realmente não edito nenhuma delas... mas o ideal seria apagar chaves do
> hash.

Não, você entendeu errado. No modelo *antigo* de threads os dados eram
compartilhados.
Nos ithreads, uma cópia é gerada pra cada thread e o que o
threads::shared faz é garantir que as cópias sejam sincronizadas.

Como eu disse antes, tente retirar o shared e ver se melhora sua situação.

-Nilson Santos F. Jr.


Mais detalhes sobre a lista de discussão Cascavel-pm