Can someone please clarify the definition of related and unrelated processes?
I know that fork creates two related processes
fork()
However, I am not sure whether the process is still considered related when we call exec* family functions to replace program image:
if (child) {
exec("path to binary", ...) <- Is it still related process
}
The reason I am asking is to clarify which IPC method can be used in which scenario. For instance, pipes
are only allowed between related processes. So I am asking above to clarify whether new program that I wrote, probably with different language, can access to the pipe file descriptors or not.
Can we say that any process created with fork() regardless of whether exec or original program image is used is always related and all others are unrelated?
Thanks!
ref: mark mitchell: advanced linux programming
A call to pipe creates file descriptors, which are valid only within that process and its children. A process’s file descriptors cannot be passed to unrelated processes; however, when the process calls fork, file descriptors are copied to the new child process.Thus, pipes can connect only related processes.