I want to run a child process in background from main function in c. I have used fork and execv functions to do so. But I also want to kill the child background process, at the end of the parent process, in case the child process has not exited yet. I will be using kill(pChildPid) function to do so. So my question is
Suppose the child process has exited before the parent process, can linux OS can allocated the same pid as that of child to some other process? If yes, then I will be unintentionally killing that process?