LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-30-2008, 05:38 PM   #1
brownaryan
LQ Newbie
 
Registered: Jun 2008
Posts: 4

Rep: Reputation: 0
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
 
Old 06-30-2008, 05:43 PM   #2
pokemaster
Member
 
Registered: Apr 2005
Location: Massachusetts, USA
Distribution: debian,ubuntu,slackware
Posts: 110

Rep: Reputation: 17
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.
 
Old 06-30-2008, 06:04 PM   #3
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
fork() exec() or system() kalleanka Programming 4 09-18-2007 05:16 AM
the difference of using fork() and exec() with system() jaepi Programming 12 06-05-2007 08:14 AM
how to fork/ exec schneidz Programming 10 08-30-2005 12:50 PM
what is the difference between Fork & exec augustus123 Linux - Newbie 1 11-29-2004 08:32 AM
Fork 'n Exec sourceman Linux - General 4 02-14-2002 03:31 AM


All times are GMT -5. The time now is 08:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration