Namespaces in operation, part 4: more on PID namespaces
Namespaces in operation, part 4: more on PID namespaces
Posted Feb 15, 2019 7:59 UTC (Fri) by mkerrisk (subscriber, #1978)In reply to: Namespaces in operation, part 4: more on PID namespaces by ywchang
Parent article: Namespaces in operation, part 4: more on PID namespaces
> Why the orphan process is not reaped by `init` process?
> And why the PPid is becoming 0?
> And why the PPid is becoming 0?
When a process becomes orphaned it is reparented to the init process *in the PID namespace of its parent*.
When you run the 'orphan' program without the '-f' option, then the child is in the new PID namespace, but its parent is still in the initial PID NS. Thus the orphan gets reparented to init in the initial PID namespace.
PPid == 0 is the system's way of telling the child process that it has no visible parent (because the parent is in another PID namespace).
