Kill Child Process

  • Follow


Hi,
My query is...

I have a parent process which forks a child process to perform certain
task.
I wish to terminate the child process after certain amount of time
(say 60 secs).
Since I dont wish to leave any zombie process, I need to notify the
Child that it has to terminate now.
The parent can terminate only after all the child processes have
terminated.

How can I achieve this task.
I heard something about SIGUSR1 signal but not sure how to use it and
how it can be useful...

Can anyone guide me please?

Thanks.
0
Reply a.k.vora (41) 9/9/2008 7:28:03 AM

On 9 Sep, 08:28, Ashit Vora <a.k.v...@gmail.com> wrote:

> I have a parent process which forks a child process to perform certain
> task.
> I wish to terminate the child process after certain amount of time
> (say 60 secs).

<snip>

you are off-topic for comp.lang.c. Please post to a platform specific
ng. For instance if you are on a Unix system try comp.unix.programming

--
Nick Keighley

0
Reply nick_keighley_nospam (4575) 9/9/2008 7:31:58 AM


Ashit Vora wrote:
> Hi,
> My query is...
> 
...off topic again.

-- 
Ian Collins.
0
Reply ian-news (9908) 9/9/2008 7:32:56 AM

On Sep 9, 12:32=A0am, Ian Collins <ian-n...@hotmail.com> wrote:
> Ashit Vora wrote:
> > Hi,
> > My query is...
>
> ..off topic again.
>
> --
> Ian Collins.

Sorry :(
0
Reply a.k.vora (41) 9/9/2008 7:34:32 AM

On  9 Sep 2008 at  7:28, Ashit Vora wrote:
> I have a parent process which forks a child process to perform certain
> task.  I wish to terminate the child process after certain amount of
> time (say 60 secs).  Since I dont wish to leave any zombie process, I
> need to notify the Child that it has to terminate now.

Remember the child's PID when you fork(2), and send it a suitable
signal with kill(2). Then in the parent process, call wait(2) so that
the child doesn't remain in the kernel process table as a zombie.


0
Reply nospam59 (9950) 9/9/2008 8:10:11 AM

4 Replies
39 Views

(page loaded in 0.148 seconds)

Similiar Articles:













7/14/2012 5:10:20 AM


Reply: