killing a child process (after fork) once its execution is done
<p>I m writing a simple web server. The program in simplified form is as follows</p>

<pre><code>while(1)
{
     // accepting the connection.
     accept();

     pid = fork();

     if(pid == 0)
     { 
          // performing some operations
          _exit(EXIT_SUCCESS);

     } else {

          sleep(1);
     }
}
</code></pre>

<p>So once the child process executes it should terminate, and the parent process should continue accepting the connection. But, for me the child process is not getting terminated and even it(child) is also accepting the connections. Am I doing any mistake here.</p>

<p>I am able to see the process (child) not being killed using.</p>

<pre><code>top -U &lt;username&gt;
</code></pre>

<p>I need help on this. Thanks in advance. :)</p>
