Use it to understand zombies, orphans, process trees and why killing a parent does not always kill its children.
Process Model
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.
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.
fork → exec → run → exit → parent wait() reaps → entry removed
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
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
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 · 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.
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.
ps -eo pid,ppid,user,stat,%cpu,%mem,etime,cmd --sort=-%cpu | head— processes by CPU with parent and statepstree -p <pid>— process treetop / htop— live CPU and memorycat /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
| Step | System call | Example in a shell |
|---|---|---|
| 1. Duplicate | fork() | The shell forks a child to run ls |
| 2. Replace the program | execve() | The child becomes /usr/bin/ls |
| 3. Run | — | ls writes to the inherited stdout |
| 4. Exit | exit() | ls ends with a status |
| 5. Collect | wait() / waitpid() | The shell reads the status into $? |
What a new process inherits
| Inherited | Not inherited / reset |
|---|---|
| UIDs and GIDs, supplementary groups | PID (new) |
| Environment variables | Pending signals |
| Open file descriptors | Memory locks |
| Working directory, umask | Resource usage counters |
| Resource limits, cgroup, namespaces |
Consequences in practice
| Effect | Reason |
|---|---|
cd in a script doesn't change your shell's directory | The script runs in a child process |
| A pipeline's output goes where the shell's stdout points | File descriptors are inherited |
| A service inherits systemd's limits and cgroup | It's forked by systemd |
| Many processes can share one log file | They 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.
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).
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
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
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%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.
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.
Quick lookup tables
Process Model operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for Process Model.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | 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. | Establish exactly what this Topic owns before crossing into another subsystem. |
| Fast verification | Pin 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 chain | parent execution context → task creation → inherited resources/credentials/namespaces → exec program image → runtime process/thread activity → exit/wait status → consumer result | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | The 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 evidence | Correlated 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 result | Use this observation only for the specific claim it actually supports. |
| Evidence limit | It 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 check | Continue 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 boundary | Process Model |
|---|---|
| Topic path | Processes → Process Model |
| Runtime state | 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. |
| 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 chain | parent 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 boundary | The 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 rule | Prove which configuration source owns the state, then prove that the running consumer loaded or generated the intended state. |