Difference between revisions of "Exec"

From Hackepedia
Jump to navigationJump to search
m
m (linking first example of fork(), linking process)
 
Line 1: Line 1:
The <code>exec()</code> system call replaces the current process with a completely different process.  This is commonly used in shells, servers, and any number of other types of software, where one program hands off execution to a different program.
+
The <code>exec()</code> system call replaces the current [[process]] with a completely different process.  This is commonly used in shells, servers, and any number of other types of software, where one program hands off execution to a different program.
  
A common proceedure is to "<code>fork()</code> and <code>exec()</code>".  Here, a process will <code>[[fork]]()</code> to create a new "child" process with the same environment and settings as the "parent" (the original process).  The child process will then <code>exec</code> the new program and carry on execution.
+
A common proceedure is to "<code>[[fork]]()</code> and <code>exec()</code>".  Here, a process will <code>fork()</code> to create a new "child" process with the same environment and settings as the "parent" (the original process).  The child process will then <code>exec</code> the new program and carry on execution.
  
 
Most command line shells use this proceedure for running programs.
 
Most command line shells use this proceedure for running programs.

Latest revision as of 22:09, 27 February 2006

The exec() system call replaces the current process with a completely different process. This is commonly used in shells, servers, and any number of other types of software, where one program hands off execution to a different program.

A common proceedure is to "fork() and exec()". Here, a process will fork() to create a new "child" process with the same environment and settings as the "parent" (the original process). The child process will then exec the new program and carry on execution.

Most command line shells use this proceedure for running programs.