Question: how fork works in linux?
Answer: The purpose of fork() is to create a new process, which becomes the child process of the caller. ... fork() returns a zero to the newly created child process. fork() returns a positive value, the process ID of the child process, to the parent. The returned process ID is of type pid_t defined in sys/types.