egunth has asked for the wisdom of the Perl Monks concerning the following question:
Hi there, I've written a fairly simple script which reads through one master list line by line and compares entries to other lists in other files, returning essentially a count of matches. The problem is, my comparison lists are rather large (100's of millions total) and each entry needs to run through each one. I have access to a large multi-core server, but I don't know how to modify my code to utilize more processors. I want to do a "work crew" thread model with each thread running a portion of the master list simultaneously and then concatenating the results at the end.
My elementary understanding of this is that I would turn my process into a subroutine with parameters dictating which list entries it will work on, then invoking new threads with the threads module to handle all sections of the master list. Does this sound like the right approach? I just want to know if there are any obvious problems with my plan of attack, or any major things I'm missing since I'm a complete multi-threading newbie.
Also, will perl automatically run these different threads on different cores, or is there something else I need to do to make that happen? I'm running perl on RHEL6 by the way.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: multi threading
by perl-diddler (Chaplain) on May 31, 2013 at 21:16 UTC | |
by egunth (Initiate) on Jun 03, 2013 at 16:31 UTC | |
by BrowserUk (Patriarch) on Jun 04, 2013 at 04:59 UTC | |
|
Re: multi threading
by BrowserUk (Patriarch) on May 31, 2013 at 20:38 UTC | |
by jakeease (Friar) on Jun 02, 2013 at 03:16 UTC | |
by BrowserUk (Patriarch) on Jun 02, 2013 at 06:31 UTC | |
by egunth (Initiate) on Jun 03, 2013 at 16:19 UTC | |
by BrowserUk (Patriarch) on Jun 03, 2013 at 16:57 UTC | |
|
Re: multi threading
by vsespb (Chaplain) on Jun 01, 2013 at 08:26 UTC | |
|
Re: multi threading
by locked_user sundialsvc4 (Abbot) on Jun 01, 2013 at 13:43 UTC |