Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Reading Elements of an array in Parallel

by RichardK (Parson)
on Feb 27, 2013 at 12:58 UTC ( #1020880=note: print w/replies, xml ) Need Help??


in reply to Reading Elements of an array in Parallel

Parallel::ForkManager looks like a good fit for what you want, it makes it easy to start a number of processes to work through a list.

use Parallel::ForkManager; $pm = Parallel::ForkManager->new($MAX_PROCESSES); foreach $data (@all_data) { # Forks and returns the pid for the child: my $pid = $pm->start and next; ... do some work with $data in the child process ... $pm->finish; # Terminates the child process }

Replies are listed 'Best First'.
Re^2: Reading Elements of an array in Parallel
by rahulruns (Beadle) on Feb 28, 2013 at 05:06 UTC

    Parallel::ForkManager helps in case of process forking but I am not able to understand how will it help in reading all elements at once

      I'm not sure what you mean by "read all the elements at once" can you explain further?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1020880]
help
Chatterbox?
[Corion]: Hmmm. I feel a Meditation coming on. I wrote a module, DBIx::PivotQuery, which returns a table-like set of rows (AoA) but some columns are generated from column values, like in an (Excel) pivot table or a ROLLUP command
[Corion]: My current approach for subtotals involves rerunning the given query, with the hint to the user that they should use a temporary table if they want better performance.
[Corion]: But I could create that temporary table in the module and use it for the improved perfomance directly instead.
[Corion]: And the question is, what would be better/preferred ;-)
[Corion]: Hmm - not exactly like the ROLLUP command. Ah well.

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (10)
As of 2017-02-23 15:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (347 votes). Check out past polls.