Nguyễn Thuỳ Chi
New member
How does fork command work?
Answer
The fork() function is special because it actually returns twice:
once to the parent process and once to the child process. In the parent process, fork() returns the pid of the child. In the child process, it returns 0. In the event of an error, no child process is created and -1 is returned to the parent.
Answer
The fork() function is special because it actually returns twice:
once to the parent process and once to the child process. In the parent process, fork() returns the pid of the child. In the child process, it returns 0. In the event of an error, no child process is created and -1 is returned to the parent.