If in a simple C program I am writing 4 calls to the fork()
API and when I execute this program then the total processes created will be 16 on Linux.
Using getpid() can get the process id of that current process.
Using getppid() can get the parent process id of the calling process.
Question: How can the last child know the process id of the first process (the ancestor's parent id) from which I call the
fork()
API four times?
NOTE: The assumption is that all processes are running; nobody died.