What Is the Exec System Call?
The exec system call loads a new program into the calling process, replacing its memory image and starting the new program from its entry point. The process ID and many descriptors are preserved, but the previous code and data are discarded. It is typically used right after a fork so the child runs a different program.
Why it matters
The fork-then-exec pair is how shells launch every external command in a build. Knowing exec preserves the process ID explains why redirections set up before it carry into the new program.
Related guides
What Is the Fork System Call?The fork system call creates a new process by duplicating the calling one, producing a child that is a near-i…
What Is an Exit Status Code?An exit status code is the small integer a process returns when it finishes, where zero conventionally means…
What Is an Environment Block?An environment block is the set of name-value variables a process carries and passes to the children it launc…