in reply to How do I run subroutines in parallel?

I have not read a comment about Windows and perl. So here my comments.

I tried the thread thing which does not work. (ActivePerl 5.6-build 62x) Now I use Win32::ProcFarm system for parallelization of code under Win32 by Toby Everett under Artistic licence. This let me start child-processes, which are Perl scripts and and do remote procedure calls over sockets, giving complete Perl data structures as parameters. It is not quit clean yet, but it works nice for me.

Depending on your tasks, parallization is not always a matter of CPUs. My App is a (preforking) server with a fixed number of childs (for now). It accepts mainframe socket connections. My childs are a downloader, which initiates source download from the mainframe via FTP and a preparer, which compiles the downloaded objects. Downloading is a task, which really allows parallel processing of other tasks. Another parallel thing feeds a GUI with status information.
Do not underestimate the coordination of parallel processes, if they do not have isolated tasks.

I do Logging with Log::Agent, this works great for me and I think it is a great module.

Ask me for more information

Update:
As Massyn answered to this post, it makes a great difference on which OS you run parent and child processes. I could not get communication via pipes, files or exit codes to work on Windows. My App depend on a windows product, so I did use a windoze only solution. The anonymous monk did not tell about his plattform.
Brutha

  • Comment on Re: How do I run subroutines in parallel?

Replies are listed 'Best First'.
Re: Re: How do I run subroutines in parallel?
by Massyn (Hermit) on Sep 10, 2002 at 09:50 UTC

    From what I've seen and heard, running this type of thing on Unix is a lot easier than on a Windows platform, then again, you can't always change your code from one OS to another.

    Although fork is one way of going, running scripts with the & operator on Unix allows a script to run in the background. You may try to use your backticks but to add the & ad the end to put the script into background mode. If the backticks don't work, try the system() function.

    I don't do this a lot, so I may be wrong. I would like to know if you managed to succeed in this.

    Remember that some Perl function like fork are reliant on the operating system, and they do function different on different platforms.