child process

A process started by another process, its parent, from which it inherits a copy of the environment and current directory.

In more detail

Because the child gets copies, nothing it changes, such as variables or the current directory, flows back to the parent. The child has its own memory and process ID, so a crash there does not bring the parent down. The parent can talk to it through pipes and wait for its exit code to learn whether it succeeded.

Examples

On Linux a process usually creates a child by copying itself with fork and then loading a new program with exec. Your shell starts each command you type as a child and waits for it unless you put it in the background. The child inherits the parent's environment, open file descriptors and identity.
Node.js starts them with spawn(), execFile(), exec() and fork() from node:child_process.
subprocess.run([sys.executable, "-c", PROBE], env={"PATH": os.environ["PATH"], "LANG": "C"})
The course passes an explicit, minimal env to subprocess.run instead of handing over everything the parent holds.

Related terms

Taught in

References