title: Get the status of a specific PID
body: <p>Simple problem but I haven't found an answer, yet. Given a specific PID, can I determine whether that process is active? I'm working on a C program and this is driving me nuts. I read somewhere that <code>kill(pid,0)</code> would do the trick, but this returns 0 regardless of whether the process is running or not (or so it seems).</p>
  
  <p>Any hints?</p>
  
  <p>Additional info:
  The process I'm interested it is a child initiated by a <code>fork()</code>.
  The child process should terminate when it reaches the statement <code>exit(0).</code> At least that's what I expected... apparently it doesn't.</p>
  
  <p>Further additional info:
  The child process that is created with a <code>fork()</code> executes a system command which can be different depending on the end-user. The whole thing is part of a batch process, so there's no chance to jump in and fix something. One of the tasks that this child process <strong>may</strong> have to perform is to establish a connection to a remote server in order to store some documents there. This might be another Linux machine or it might be a Win Server (or possibly something else). For this reason I don't want to wait for the child process. I would like the parent to wait a specific length of time (say 10 seconds) and then kill the child process if it hasn't completed by then. By the same token, I don't want the parent process to wait 10 seconds if the child completed its task in 3 milliseconds.</p>
  
  <p>It seems I'm not the first to have this problem.</p>