My idea:

- Create an array of sub refs (why using sub refs - best practice if u need 
different subs on each element)
- Execute each element found on the array as thread, and collect results into 
another array (use the ref subs array index
  as index on the results array)
- loop the array and create the report.

As for using threads / forks / modules that does the same - I assume that all 
goes to kernel forks - so it doesn't matter to me.
Searching CPAN I found the module from Nicholas Clark quite nice, less work, 
more readability, and also support shared / none share environments,
also support thread locking (not that I see u need any of these).

Thanks
Chanan


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of 
Yossi Itzkovich
Sent: Monday, June 08, 2009 3:52 PM
To: Perl in Israel
Subject: Re: [Israel.pm] Parallel jobs

Because I want to collect the results , send a nice report etc.


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of 
Avishalom Shalit
Sent: Monday, June 08, 2009 3:55 PM
To: Perl in Israel
Subject: Re: [Israel.pm] Parallel jobs

why does it have to be in the same program , if they don't communicate much?
i mean, why not run a script to invoke many instances of the program
to the stations ?


2009/6/8 Yossi Itzkovich <[email protected]>:
> Thanks,
>
> I need them basically to run (more or less unrelated ) tasks in parallel.  
> For example: Connect to dozens of stations and run there a long operation.  I 
> don't want to wait long time by doing them sequentially.
>
> I prefer threads, but I wrote in the original mail why I can't.
>
>
> Yossi
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of 
> Avishalom Shalit
> Sent: Monday, June 08, 2009 3:01 PM
> To: Perl in Israel
> Subject: Re: [Israel.pm] Parallel jobs
>
> resending
>
> 2009/6/8 Avishalom Shalit <[email protected]>
>>
>> i had used pearl threads,
>> it isn't too complicated and most things i needed were threadsafe.
>> however , they are not lightweight at all,
>> they are masked forks, and like forks, you really want to spawn them as 
>> early as possible .
>>
>> what do you need them for ?
>>
>> 2009/6/8 Yossi Itzkovich <[email protected]>
>>>
>>> Hi,
>>>
>>> I would like to ask how you people work with parallel jobs 
>>> (processes/threads) in Perl (>=5.8.4).
>>> I know there are simple built in commands (open, fork etc.) but I am asking 
>>> about higher order managers.
>>> Threads might be good - but not enabled by default in Perl build -so I am 
>>> limited (also not all modules are thread safe).
>>> I have been using Parallel::Jobs for a while, and I read a little about 
>>> Parallel::Forker, but I wanted to know if there are better alternatives out 
>>> there.
>>>
>>>
>>> Thanks for your help.
>>>
>>> Yossi
>>> _______________________________________________
>>> Perl mailing list
>>> [email protected]
>>> http://mail.perl.org.il/mailman/listinfo/perl
>>
>>
>>
>> --
>> -- vish
>
>
>
> --
> -- vish
> _______________________________________________
> Perl mailing list
> [email protected]
> http://mail.perl.org.il/mailman/listinfo/perl
> _______________________________________________
> Perl mailing list
> [email protected]
> http://mail.perl.org.il/mailman/listinfo/perl
>



-- 
-- vish
_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl
_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl
No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.5.339 / Virus Database: 270.12.56/2161 - Release Date: 06/07/09 
17:53:00

_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl

Reply via email to