Click here to get back home

Thread alternative for multi-processing?

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Thread alternative for multi-processing? howa 04-16-2008
Posted by howa on April 16, 2008, 4:44 am
Please log in for more thread options
Sometimes, I want to take the advantage of multi-core processor, and
make the full use of my CPU time,

e.g. I have a function, which takes a file name as input, do some text
processing (e.g. CPU intensive), and save it back.

I don't want to use thread, as it need to recompile perl on all my
machines and I am not sure if it is stable enough to affect other
apps.

I don't mind to have a little overhead in using the fork mode (i.e.
multi-process). I want to know are there any recommended module for
my purpose?

For example, I am trying Parallel::ForkManager, POE::Wheel::Run, so
anyone want to share the experiences?


Thanks.

Posted by Peter Makholm on April 16, 2008, 4:50 am
Please log in for more thread options

> For example, I am trying Parallel::ForkManager, POE::Wheel::Run, so
> anyone want to share the experiences?

I have used Parallel::ForkManager a lot with no problems, it just
works. I have never had the need to communicate enything more complex
than the exit code back to the parrent though.

//Makholm

Posted by nolo contendere on April 16, 2008, 11:03 am
Please log in for more thread options
> > For example, I am trying Parallel::ForkManager, POE::Wheel::Run, so
> > anyone want to share the experiences?
>
> I have used Parallel::ForkManager a lot with no problems, it just
> works. I have never had the need to communicate enything more complex
> than the exit code back to the parrent though.

I've found it useful to pass an $ident which i can use in the
run_on_finish callback to associate with the exit code.

Posted by Peter Makholm on April 16, 2008, 11:10 am
Please log in for more thread options

>> I have used Parallel::ForkManager a lot with no problems, it just
>> works. I have never had the need to communicate enything more complex
>> than the exit code back to the parrent though.
>
> I've found it useful to pass an $ident which i can use in the
> run_on_finish callback to associate with the exit code.

Yes, but I consider this to be communication from the parrent on fork
time to the parrent on wait time. Even if the $ident is an reference
to something, the child can't change it for the parrent.

//Makholm

Posted by nolo contendere on April 16, 2008, 12:32 pm
Please log in for more thread options
> >> I have used Parallel::ForkManager a lot with no problems, it just
> >> works. I have never had the need to communicate enything more complex
> >> than the exit code back to the parrent though.
>
> > I've found it useful to pass an $ident which i can use in the
> > run_on_finish callback to associate with the exit code.
>
> Yes, but I consider this to be communication from the parrent on fork
> time to the parrent on wait time. Even if the $ident is an reference
> to something, the child can't change it for the parrent.
>

True, perhaps I should have replied to the OP. I was simply sharing my
experience with Parallel::ForkManager, didn't mean to imply that the
$ident was a child->parent communication.

Similar ThreadsPosted
Problem starting a new thread from another thread July 25, 2006, 7:18 pm
mod_expires alternative August 2, 2004, 4:00 pm
alternative to MS word doc January 17, 2005, 6:15 pm
Alternative in regexps February 9, 2005, 7:52 pm
alternative to calltree ? February 28, 2006, 11:52 am
mime head alternative April 19, 2007, 1:42 pm
Alternative to Parallel::ForkManager April 23, 2008, 2:29 pm
Question? Alternative to loading modules!!! January 20, 2005, 7:07 am
Recursive regular expression (or alternative) April 12, 2006, 4:04 pm
%%%%% A Powerful, Safe and Economical Alternative to VIAGRA %%%%% January 4, 2008, 2:30 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap