(PID) Namespace basic topics
With namespaces you can have multiple nested process trees (instead of one like in the „old“ days) … Every tree is isolated from the others … so it’s not possible to kill an process of the other namespace … even if the process id’s is the same within the different namespaces …
A process can have the same or a different pid within the namespaces -> namespaces are hierarchical … once a new namespace is created, all the tasks in the parent namespace will see the process in this new namespace, but processes from the new namespace will not see the ones from the parent
So every process needs more than one pid -> one for each namespace … The child process will have pid 1 and all orphaned process will re-parent to it … when this process dies, the namespace will be terminated! … so the child must be something like the „master“ … for example, a concurrent network server which spawns processes for the work should be the „master“ …
After creating a new namespace you should change the root dir and mount a new /proc instance. Otherwise procs like ps wont work … for example a user process creates a proc_myns dir, spawn a new namespace and mount /proc to that dir …