in reply to Caught Forking() around again
There are several options, some of which were pointed out in this recent node
I'll go on about forking()..
You can fork() then exec() if you want to run external commands, or fork() and run a block of code if you want to do everything in Perl.
Parallel::ForkManager is a nice module which may help fork and track tasks to be run in parallel.
Hand rolling your own forking and process tracking subroutines/modules might be other option - co-ordinating a number of dependent tasks is not easy.
If you can perform a number of tasks, wait for of all them to finish, check the statuses, then execute another block of parallel tasks, it's not impossible, just takes a bit of thinking :-)
If you want to know when a child process has finished, you could either:
My personal solution was to roll a module to handle fork()'ing and another to dole out tasks, track their return codes, and resubmit them to be processed again if they failed.
I just looped with a small delay to stop the parent eating a lot of CPU time.
Hope that helps.
BazB.
|
|---|