Pcornel
Browse topics
Options
Recent
Favorites
Linux · Technical reference

Process Model

Direct answer

The Linux process model: a parent process forks a copy of itself, the child execs a new program, both are scheduled by the kernel, and when a child exits the parent collects its exit status. PID 1 (systemd) adopts orphans.

When to use this

Use it to understand zombies, orphans, process trees and why killing a parent does not always kill its children.

First 30 seconds

1. pstree -p <pid> — parent and children.

2. Zombies: ps -eo stat,ppid,pid,cmd | awk '$1~/Z/' — note the PPID.

3. Restart the parent that does not reap them.

4. Orphans → re-parented to PID 1 or a subreaper; stop them via their unit.

5. systemd-cgls — which unit owns each process.

Operational verification

fork → exec → run → exit → parent wait() reaps → entry removed

Evidence · next step

For Processes → Process Model, continue with the first unproven Topic check: Identify the parent/launcher and resulting process tree rather than only the final executable name. If that boundary is healthy, advance to the adjacent check: Capture cmdline, environment-relevant context, cwd, credentials, namespaces/cgroup and important open descriptors. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.

Continue only after interpreting the current observation.
Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
linux
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

Platformlinux
Scope / prerequisiteUse it to understand zombies, orphans, process trees and why killing a parent does not always kill its children.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

5 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Operational evidence path Verify boundary

parent execution context → task creation → inherited resources/credentials/namespaces → exec program image → runtime process/thread activity → exit/wait status → consumer result

Healthy evidence: the observed process ancestry, exec image and inherited runtime context match the intended launch design and the program completes or remains healthy as expected.

Step 2 Verification and output interpretation Verify boundary

Existing fast checks for this Topic. - Identify the parent/launcher and resulting process tree rather than only the final executable name.

  • Capture cmdline, environment-relevant context, cwd, credentials, namespaces/cgroup and important open descriptors.
  • Distinguish task creation from exec and note where identity or resource inheritance changes.
  • Correlate exit/signal information with application logs and the original acceptance test.

Verification chain. parent execution context → task creation → inherited resources/credentials/namespaces → exec program image → runtime process/thread activity → exit/wait status → consumer result

Step 3 Commands Verify boundary
ps -ef --forest | head
pstree -p | head
Step 4 Failure modes and next checks Narrow the fault

Suspicious evidence: an unexpected parent, namespace, descriptor, cwd or credential is ignored because the executable name looks correct.

Step 5 Common mistakes Narrow the fault
  • Assuming child processes die with the parent.
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points

A zombie (Z) has exited but its parent has not read its status — it uses no CPU or memory; fix or restart the parent. Children keep running when the parent dies unless they are in the same systemd cgroup that is stopped.

Key checks
  • ps -eo pid,ppid,user,stat,%cpu,%mem,etime,cmd --sort=-%cpu | head — processes by CPU with parent and state
  • pstree -p <pid> — process tree
  • top / htop — live CPU and memory
  • cat /proc/<pid>/status — state, threads and memory of one process
ReferenceWhat it is1 section · depth on demand

Core model

Trace a workload from parent context through fork/clone-style task creation and exec into the resulting program image. Record inherited descriptors, environment, working directory, credentials, namespaces and cgroups because these can explain behavior that the executable name alone cannot. Distinguish process image replacement by exec from creation of a new PID.

ReferenceImportant terms & boundaries5 sections · depth on demand

What this shows and what it does not

The process model explains how execution context is created and inherited, not whether the program logic, external dependencies or service contract are correct.

In depth

The Unix process model: fork, exec and wait

New processes on Linux are created by duplicating an existing one. The fork(2) manual page describes the mechanism:

  • fork() creates a child that's a duplicate of the parent, running in its own memory space, with identical contents at first.
  • The parent receives the child's PID, and the child receives 0.
  • On Linux the copy is cheap, because pages are shared copy-on-write until either side changes them.
  • The child gets copies of the parent's file descriptors, which refer to the same open files, including the file offsets.
  • Some things aren't inherited: memory locks and pending signals, and the CPU usage counters start at zero.

The life cycle

StepSystem callExample in a shell
1. Duplicatefork()The shell forks a child to run ls
2. Replace the programexecve()The child becomes /usr/bin/ls
3. Run—ls writes to the inherited stdout
4. Exitexit()ls ends with a status
5. Collectwait() / waitpid()The shell reads the status into $?

What a new process inherits

InheritedNot inherited / reset
UIDs and GIDs, supplementary groupsPID (new)
Environment variablesPending signals
Open file descriptorsMemory locks
Working directory, umaskResource usage counters
Resource limits, cgroup, namespaces

Consequences in practice

EffectReason
cd in a script doesn't change your shell's directoryThe script runs in a child process
A pipeline's output goes where the shell's stdout pointsFile descriptors are inherited
A service inherits systemd's limits and cgroupIt's forked by systemd
Many processes can share one log fileThey share the same open file description
host$ echo "shell PID $$"; bash -c 'echo "child PID $$, parent $PPID"'
shell PID 4410
child PID 9921, parent 4410
host$ strace -f -e trace=clone,clone3,execve,wait4 -o /tmp/trace bash -c 'ls / > /dev/null'
host$ grep -E "clone|execve|wait4" /tmp/trace | head -4
9930  execve("/usr/bin/bash", ["bash", "-c", "ls / > /dev/null"], ...) = 0
9930  execve("/usr/bin/ls", ["ls", "/"], ...) = 0
host$ cat /proc/$$/limits | grep -E "open files|processes"

Reading the strace output

For the last command of a bash -c string, Bash often skips the fork and execs ls directly in its own process. That's why the same PID appears in both execve lines. With several commands, clone calls appear for each child, followed by wait4 while Bash waits for them.

Documented example, not captured output.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

How it works at runtime

Process Model is part of Processes → Process Model. The Linux process model combines task creation, exec, virtual memory, file-descriptor inheritance, credentials, namespaces, signals, scheduling and exit/wait semantics into the execution context visible to user space.

Topic-specific state model. The Linux process model combines task creation, exec, virtual memory, file-descriptor inheritance, credentials, namespaces, signals, scheduling and exit/wait semantics into the execution context visible to user space.

Interpretation rule. - fork/clone-style creation ≠ exec image replacement.

  • Executable path ≠ complete runtime context because descriptors, environment, credentials and namespaces matter.
  • Thread/task ≠ necessarily a separate application process boundary.
  • Exit status ≠ complete explanation of why a workload failed.

Quick reference

Process model: a process is created with fork()/clone() (copy of parent) and usually replaces its program with execve(). It has its own address space, file descriptors, credentials, cgroup and namespaces; threads are tasks sharing an address space.

strace -f -e trace=clone,execve bash -c 'ls | wc -l'
cat /proc/<pid>/status | grep -E 'State|Threads|VmRSS|voluntary'
ls /proc/<pid>/task | wc -l       # threads

When a process exits, its parent must reap it (wait()); until then it is a zombie. Orphans are adopted by PID 1 or a subreaper (systemd user manager, container init).

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Limits and how it fails

Primary failure point. The process model explains how execution context is created and inherited, not whether the program logic, external dependencies or service contract are correct.

ReferenceConfiguration & state1 section · depth on demand

Configuration, persistence and lifecycle

Distribution/platform context. Process Model owns generic execution-context semantics; shell expansion, systemd service launch, containers and application internals remain in the relevant Topics.

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor doclinux current

Authoritative/upstream documentation reviewed for bounded claims in Processes → Process Model. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://gitlab.com/procps-ng/procps · confidence 94%
Technical changelog & impact

What changed and what may be affected

Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.

Related reference impactReview these references after material technical changes when their shared boundary is affected.
Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
linux process modelfork exec linuxprocess execution contextlinux task model
Embedded reference data

Quick lookup tables

Process Model operational reference

Topic-specific lookup boundaries, proof limits and next-step Evidence for Process Model.

Lookup boundaryTopic-specific referenceOperational use
Scope / effective stateThe Linux process model combines task creation, exec, virtual memory, file-descriptor inheritance, credentials, namespaces, signals, scheduling and exit/wait semantics into the execution context visible to user space.Establish exactly what this Topic owns before crossing into another subsystem.
Fast verificationPin host/container + timestamp → identify exact process or unit → capture PID plus start identity and cgroup/unit → resolve effective unit fragment + drop-ins → inspect dependency/order transaction → record systemd job result → verify process/cgroup and active/sub state → prove application readiness → repeat the original workload test.Use the shortest evidence path first; a fast check is a boundary test, not blanket proof.
Verification chainparent execution context → task creation → inherited resources/credentials/namespaces → exec program image → runtime process/thread activity → exit/wait status → consumer resultTrace requested/configured state through effective state to the observed workload result.
Failure boundaryThe process model explains how execution context is created and inherited, not whether the program logic, external dependencies or service contract are correct.Stop broad troubleshooting at the first boundary that is not supported by evidence.
Positive evidenceCorrelated Linux process/systemd evidence can establish this proof path: parent execution context → task creation → inherited resources/credentials/namespaces → exec program image → runtime process/thread activity → exit/wait status → consumer resultUse this observation only for the specific claim it actually supports.
Evidence limitIt does not independently prove behavior outside the captured process, manager, unit, dependency, runtime or application scope. The process model explains how execution context is created and inherited, not whether the program logic, external dependencies or service contract are correct.Do not promote a local success signal into end-to-end or adjacent-dependency proof.
Next troubleshooting checkContinue from the first unproven boundary: reacquire stable process identity, inspect effective loaded unit configuration and dependency/job state, correlate process/cgroup plus journal evidence, then run the original readiness/workload test before changing additional settings.Continue to the next unresolved boundary while preserving the original test condition.

Process Model · operational reference

Compact Linux state, persistence, verification and boundary reference for fast lookup.

Reference boundaryProcess Model
Topic pathProcesses → Process Model
Runtime stateThe Linux process model combines task creation, exec, virtual memory, file-descriptor inheritance, credentials, namespaces, signals, scheduling and exit/wait semantics into the execution context visible to user space.
Fast checks- Identify the parent/launcher and resulting process tree rather than only the final executable name. - Capture cmdline, environment-relevant context, cwd, credentials, namespaces/cgroup and important open descriptors. - Distinguish task creation from exec and note where identity or resource inheritance changes. - Correlate exit/signal information with application logs and the original acceptance test.
Verification chainparent execution context → task creation → inherited resources/credentials/namespaces → exec program image → runtime process/thread activity → exit/wait status → consumer result Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary. Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return path or regression → explicit Evidence boundary.
Failure boundaryThe process model explains how execution context is created and inherited, not whether the program logic, external dependencies or service contract are correct. Boundary chain: process/context → userspace configuration → kernel subsystem/resource → device/network/filesystem dependency → effective state → original workload.
Persistence ruleProve which configuration source owns the state, then prove that the running consumer loaded or generated the intended state.
Confirmation

Confirm action

Continue?