On success, the PID of the child process is returned in the parent’s thread of execution, and a 0 is returned in the child’s thread of execution.
p = fork();
I'm confused at its manual page,is p
equal to 0
or PID
?
On success, the PID of the child process is returned in the parent’s thread of execution, and a 0 is returned in the child’s thread of execution.
p = fork();
I'm confused at its manual page,is p
equal to 0
or PID
?
Fork creates a duplicate process and a new process context. When it returns a 0 value it means that a child process is running, but when it returns another value that means a parent process is running. We usually use wait statement so that a child process completes and parent process starts executing.