LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   fork Vs. spwan (https://www.linuxquestions.org/questions/linux-newbie-8/fork-vs-spwan-933843/)

anandg111 03-11-2012 12:28 AM

fork Vs. spwan
 
what is diffenrence between spawn and fork ?

"fork() system call spawns the processess" what is mean by this sentence.

catkin 03-11-2012 09:13 PM

AFAIK "spawns" means "creates" with the added implication that every new process is the child of a previous process (except for the first!).

The way that a process creates a new process is via the fork (or vfork) system call. On receiving the fork call, the kernel creates a new process that is an exact duplicate of the parent except for the PID and the return value from the fork call (there may be other differences I have forgotten). Both processes (parent and child) examine the return form the fork call to identify which one they are and then ... whatever the programmer decided -- typically the child executes a system call from the execve family.

John VV 03-11-2012 11:18 PM

that sounds like a homework question , and should be in the textbook .


All times are GMT -5. The time now is 10:36 PM.