I am looking for C code to use on a Linux based system to start another process asynchronously. The second process should continue, even if the first ends. I've looked through the "fork" and "system" and "exec" options, but don't see anything that will spawn a peer process that's not communicating with or a child of the original process.
Can this be done?
In Linux (and Unix), every process is created by an existing process. You may be able to create a process using fork
and then, kill the parent process. This way, the child will be an orphan but still, it gets adopted by init
. If you want to create a process that is not inherited by another, I am afraid that may not be possible.