[TAG] perl: forking and children.... again
Ben Okopnik
ben at linuxgazette.net
Thu Jul 5 06:37:56 MSD 2007
As sometimes happens, shortly - or not so shortly - after we finish a
discussion in TAG, more info about the problem pops up out of nowhere,
usually as a result of a completely unrelated Google search. I
*swear*, if we were to have a discussion about Martian blood-drinking
weasels, next week I'd run into a "The Vampire Mustelids of Ares: A
Personal Interview" while searching for soap-scum removal info...
Anyway, Karl-Heinz: while I was fiddling about trying to come up with a
"max-spread" sorting algorithm [1], I ran across a reference to
Parallel::ForkManager on 'http://perlmonks.org'. Doing a quick lookup on
CPAN came back with this (snipped from the documentation):
``
This module is intended for use in operations that can be done in
parallel where the number of processes to be forked off should be
limited. Typical use is a downloader which will be retrieving
hundreds/thousands of files.
The code for a downloader would look something like this:
[...]
''
This sounds like exactly the kind of thing you were describing. It
allows nicely fine-grained individual control of the child processes,
etc. - take a look!
http://search.cpan.org/author/DLUX/Parallel-ForkManager-0.7.5/ForkManager.pm
There's also Parallel::ForkControl -
http://search.cpan.org/author/BLHOTSKY/Parallel-ForkControl-0.04/lib/Parallel/ForkControl.pm
[1] For the mathematicians among us, you might find this to be fun. See
my next post.
--
* Ben Okopnik * Editor-in-Chief, Linux Gazette * http://LinuxGazette.NET *
More information about the TAG
mailing list