LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   what is the difference between fork and exec command? (https://www.linuxquestions.org/questions/linux-newbie-8/what-is-the-difference-between-fork-and-exec-command-652659/)

brownaryan 06-30-2008 04:38 PM

what is the difference between fork and exec command?
 
Hi friends,

Can anybody tell me what is the difference between fork and exec command?

Regards

Brownaryan

pokemaster 06-30-2008 04:43 PM

fork executes two child processes, exec turns over execution to a new process.

exec behaves the same as forking a process, then exiting the unforked branch.

pinniped 06-30-2008 05:04 PM

Read the manual.

exec:
The exec() family of functions replaces the current process image with a new process image.
[translation: Uses the process structures of the calling process to run a new program.]

fork:
fork() creates a new process by duplicating the calling process.

Simple really - they don't have anything to do with eachother.


All times are GMT -5. The time now is 05:42 PM.