I have a program wherein i use fork. In the child process, i just login to a remote server and executes a command. In the parent process, i wait for the child to finish its task. If it doesnot finish it in a predetermined amount of time, i kill the child process using kill(child_pid, SIGTERM).
But i have noticed that this leaves behind zombie process like
93113 s000 Z+ 0:00.00 (ssh)
and as the timeouts increase, the zombie process also increase and ultimately the ssh cannot be used anymore.
how can i kill the child process without creating zombies that haunt me??
Even if you
killthe child, you still need towaitfor it.