I have a question about number of PIDs a process has in context of Linux PID namespaces.Suppose: (NS = namespace)P1 (PID NS1) -> clone -> P2 (PID NS2) -> clone -> P3 (PID NS3)How many PIDs does P3 have ?I think the following, but I'm not sure if its correct :one for NS3one for hostone for NS2one for NS1Thanks.
Linux PID namespaces
linux;namespace
By definition of a PID namespace, a process that exists in a namespace has a PID in that namespace, and a (different, except for coincidences) PID in each ancestor namespace. So a process in NS3 has 4 different PIDs: one in NS3, one in NS2, one in NS1, and one in the root namespace.There is a good series of posts by Michael Kerrisk about namespaces on LWN read in particular Part 3: PID namespaces and Part 4: more on PID namespaces.