User: Password:
|
|
Subscribe / Log in / New account

eclone()

eclone()

Posted Nov 26, 2009 23:59 UTC (Thu) by efexis (guest, #26355)
In reply to: eclone() by socket
Parent article: eclone()

Yeah I get what you're saying but it's all cool (at least on the proposals I looked in more detail at, I assume the case is still the same here); the process's 'real' PID will still be the same as what it always would've been if it had been fork()ed or clone()ed at that point without specifying a new PID for it. If you want to send it a kill signal or look at its memory usage in /proc/$pid, nothing will have changed there. But what you're doing with the clone() call is creating a new PID namespace, and the process is born within this namespace, and gets a new 'virtual' PID that addresses it from within there. Any other processes that also exist in that namespace will talk to the process with the new virtual PID, and cannot talk to processes that don't have a PID in that namespace. For example, each new namespace can be born with a process with PID of 1 which acts as the init (collecting child processes that live longer than their parents do etc), but to the outside world the process may have a PID of 16384 for all it matters.

Therefore any process can start up with a PID of its choosing providing you create a namespace for it and don't fill it with other stuff first. The idea here is that you can suspend a whole container(/namespace) full of processes with virtual PIDs that may be talking to each other by PID, write them out to disc, and then at a later point recreate all the processes from the image into a new container with the same virtual PIDs (but new real PIDs) and they won't need to any of the wiser.

:-)


(Log in to post comments)


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds