PetaMem has asked for the wisdom of the Perl Monks concerning the following question:
I tried to understand fork. I think that I basically got the
theory behind it, but am far away from practical usage of this
nifty feature. What do I want to achieve? I want to simply harness
the power of SMP machines - just use all the nice BogoMIPS for
computational intensive tasks.
My first shot at it was Parallel::ForkManager:
While this is really great because the loop just takes halfuse Parallel::ForkManager; # Yadda yadda local %hash; $pm = new Parallel::ForkManager(2); # Want use 2 CPUs now (###) foreach $thingy (@so_30_member_list) { my $pid = $pm->start and next; # (###) $hash{$thingy} = &big_heavy_computation_of($thingy); $pm->finish; # Terminates the child process (###) } &look_at_hash;
So now for me to better understand this. I assume, that with
the $pm->start and next a new child is forked with
completedly his own data, thus filling his own instance
of %hash, and then ... well ... just discarding it.
This isnīt actually what I want. How can I get the computer doing
what I want and not what Iīm telling him? :-)
Any help apreciated
Ciao
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: FORRRRRK again...
by busunsl (Vicar) on Jun 28, 2001 at 14:50 UTC | |
|
Re: FORRRRRK again...
by holygrail (Scribe) on Jun 28, 2001 at 17:29 UTC | |
|
Re: FORRRRRK again...
by PetaMem (Priest) on Jun 28, 2001 at 17:37 UTC | |
by Zapawork (Scribe) on Jun 28, 2001 at 20:06 UTC | |
by Eradicatore (Monk) on Jun 28, 2001 at 18:37 UTC |