Computer Systems A Programmer's Perspective Second Edition
This is a good place to pause and make sure you understand the distinction between a program and a
process. A program is a collection of code and data; programs can exist as object modules on disk or
as segments in an address space. A process is a specific instance of a program in execution; a program
always runs in the context of some process. Understanding this distinction is important if you want to
understand the fork and execve functions. The fork function runs the same program in a new child
process that is a duplicate of the parent. The execve function loads and runs a new program in the
context of the current process. While it overwrites the address space of the current process, it does not
create a new process. The new program still has the same PID, and it inherits all of the file descriptors
that were open at the time of the call to the execve function.