Fork creates a child with selected shared references; exec keeps that child’s PID while replacing its program.

Fork creates a process; exec replaces its program

Fork followed by exec is one common Unix process-launch model. fork creates a child process, while a successful execve replaces the calling process’s program image. They solve different problems and have different inheritance rules. Understanding the distinction matters when arranging input, output, environment, and lifecycle management for a command started by another program. ...

October 12, 2027 · 5 min · XB Field Notes