c fork's child ppid does not match parent's pid

It is likely the parent process has already exited and no longer exists. You could try some delay in the parent.


'init' which is the root process running in a linux system has pid 1 .

When a process's parent gets terminated before itself(i.e. the child) , the child becomes an 'orphan' process and is taken up by the root process or the process just above the hierarchy of the process which created it(parent process) .

Hence , here it is taken up by and executed under init which has pid = 1 . So, delay your parent process for solution.

Tags:

C

Fork