Pcornel
Linux · Processes

Process Model

Cheat sheet · https://pcornel.dk/topic.php?topic=2714

Back to the Topic

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.

Remember

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.

First 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

Verify in this order

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

Where it usually breaks

First mismatch in hardware/kernel capability → scheduler/mm/device → cgroup/namespace → process/thread → service/runtime → workload behavior/counters; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2714

Confirmation

Confirm action

Continue?