0

The title was a question in an exam I had recently. I could not find the answer afterwards in the slides (also not on the web). In the course slides it is only described that the parent process holds the PIDs of its child process but not how it received them.

My guess is that transmission of the IDs is directly done with the fork command or afterwards through signals.

2

My guess is that transmission of the IDs is directly done with the fork command or afterwards through signals.

It’s the former: fork() returns the child PID to the parent. See Why does fork sometimes return parent and sometimes child? for more detail (and man 2 fork of course, and the POSIX definition).

A process can find its parent’s PID using the getppid() system call (also defined by POSIX).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.