[Pdx-pm] to fork or thread...
Chris Dawson
cdawson at webiphany.com
Sun Sep 21 12:57:46 CDT 2003
Hello,
I am trying to write a SOAP client/server program. I want to start
another program inside my start() method, and then stop that program
using the stop() method. I am unsure as to how I should execute the
child program, and then what I should do to stop it. I have been
experimenting with fork, but I don't know the proper way to kill the
child process. I am happy to use perl 5.8 and the threads module if
necessary, but I am not clear on whether I should signal the external
application, kill it using it's pid, or what. Any suggestions? This is
all happening in a linux environment, so that should simplify things. I
have tried writing a script which upon the stop() method, runs a
'killall program_name' but this appears to leave a bunch of zombie
processes, which is not optimal. They don't get cleaned/reaped until
the program is shutdown completely, and I want to have this running
non-stop for a while. I don't think the zombies are an issue and are
not consuming resources, but I think there must be a limit to the number
of child processes associated with an application, correct?
So, briefly this is pseudo-code for what I want to do
sub start {
$pid = ( exec | fork | new thread | async start ) "program name"
return true
}
sub stop
{
kill $pid
return true
}
Thanks,
Chris
More information about the Pdx-pm-list
mailing list