Difference between revisions of "Exec"
From Hackepedia
Jump to navigationJump to searchm (linking first example of fork(), linking process) |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
− | The <code>exec()</code> system call replaces the | + | 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> | + | 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.