When a parent process is executing as well as child process is also executing (child process is created by fork() system call) . In case parent process stops executing and terminates . Then the child process immediately becomes orphan and the process id of parent process is removed from process table as well.
But the child process still have ppid (child process have ppid of parent process not in this case ), child process has ppid ie pid of parent process but parent in this case is terminated ,in such situation where the parent is terminated before child , systemd comes in role and immediately adopts the child and the pid of systemd will be the ppid of the child process.
Orphan and adoption
When a process is executed its process context is created. Child process is executed as well
as by using fork(); Child process shares the same process context of parent process but the
physical address is different of parent process and child process.
If the child process executed completely it turns into zombie state and <defunct> that means it
is no longer existing or functioning. We can check the states of the processes by command
ps -ax.
Now comes to the part where parent process executed before child process. In such case
parent process would completely executed and terminated so no longer process state would
be there in process table. So child process becomes ORPHAN and it needs a parent to
execute further.
SystemD is the grand grand parent under which all the process functioning. So SystemD
adopt the child process immidiately and become parent for child process. PID of systemD
become the PPID of child process.
This is the concept of OPPHAN and ADOPTION.
It looks like you're new here. If you want to get involved, click one of these buttons!