No. fork() gives the child a new PID; the child’s PPID is the PID of the process that called fork(). If the child then successfully calls execve(), it keeps its own PID and PPID while its program image is replaced.
What happens to the PIDs across fork and exec?
Let the process that calls fork() have PID P and PPID G. The identifiers change like this:
| Point in sequence | Running program | PID | PPID |
|---|---|---|---|
Before fork() |
The original process | P | G |
After fork() |
Parent | P | G |
After fork() |
New child | C, a new unique PID | P |
After the child successfully calls execve() |
The program loaded by exec | C | P |
The child does not inherit the parent’s numeric PID. Linux and POSIX specify that the child has its own unique PID and that its PPID is the PID of the process that called fork() (Linux fork(2); POSIX fork()). Linux documents that both PID and PPID are preserved across execve() (credentials(7)).
Does exec create a new process?
No. execve() replaces the calling process’s program image; it does not create another process. The Linux execve(2) manual states that “there is no new process” and that the calling process’s PID remains unchanged. So when a child calls exec, it is still the same child process, now running a different program.
#1 Best Overall
People sometimes say that exec “starts a new process.” That is shorthand for starting a new program image in an existing process. The distinction matters when tracking process trees, PIDs, or a parent’s relationship to a child.
What changes when the child calls exec?
Exec replaces the program’s executable image, including its code, data, heap, and stack, with the image initialized for the target program. It does not preserve the old application memory as if the old program were continuing. At the same time, process identity and the parent-child relationship remain: the PID is still C and the PPID is still P.
Rank #2
Some process attributes have specific exec behavior rather than simply remaining untouched. The Linux execve(2) documentation describes exceptions including caught signal dispositions, the alternate signal stack, memory mappings, attached System V shared memory, POSIX shared-memory mappings, POSIX message-queue descriptors, named semaphores, and POSIX timers. Thus, “the same process” means the same process identity—not that every part of its state or memory remains identical.
What if exec returns?
A successful execve() does not return to the old program: the old image has been replaced. If the call returns, it failed, so the old image is still running. The caller should inspect errno to determine the failure.
Free tools Windows power users keep installed
One-click scans. No signup required.
Quick Recap
Best Value
Rank #4
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




