🔧 Tools & Platforms
Linux Process Management
Every running program on a Linux system is a process — an instance of an executable with its own memory space, file descriptors, and process ID (PID). Bresnahan and Blum explain the process lifecycle from creation (fork/exec) through execution to termination, and the tools for monitoring, controlling, and prioritizing processes. Understanding process management is essential for diagnosing performance problems, managing server workloads, and ensuring critical services stay running. A process is not the same as a program: a single program can spawn multiple processes, and understanding this distinction is key to managing Linux systems effectively.
2
Minutes
2
Concepts
+45
XP
1
How It Works
  1. Process lifecycle and PIDs — Every process has a unique PID assigned by the kernel. PID 1 is the init system (systemd on modern distros). New processes are created by forking an existing process (parent) and optionally replacing its image with a new program (exec). Each process has a parent PID (PPID), forming a tree visible with pstree.
  1. Monitoring with ps and top — Two essential tools:
  • ps aux — snapshot of all running processes with user, PID, CPU%, MEM%, command
  • ps -ef — full-format listing with PPID relationships
  • top / htop — real-time, updating view of processes sorted by resource usage
  • Key top columns: PID, USER, PR (priority), NI (nice value), VIRT/RES/SHR (memory), %CPU, %MEM, COMMAND
  1. Signals and kill — Processes communicate through signals. The kill command sends signals by PID:
  • SIGTERM (15) — polite termination request; process can clean up: kill PID
  • SIGKILL (9) — forced termination; no cleanup: kill -9 PID
  • SIGHUP (1) — hangup; many daemons reload config on SIGHUP: kill -HUP PID
  • SIGSTOP (19) — pause process: kill -STOP PID
  • SIGCONT (18) — resume paused process: kill -CONT PID
  • killall — kill by name: killall nginx
  • pkill — kill by pattern: pkill -f "python script.py"
  1. Background and foreground jobs — The shell manages jobs:
  • command & — start in background
  • Ctrl+Z — suspend foreground process
  • bg — resume suspended process in background
  • fg — bring background process to foreground
  • jobs — list current shell jobs
  • nohup command & — run process that survives shell exit
  1. Priority and nice values — Linux schedules CPU time based on priority. Nice values range from -20 (highest priority) to 19 (lowest). Regular users can only increase nice (lower priority); root can decrease it.
  • nice -n 10 command — start with lower priority
  • renice -n 5 -p PID — change priority of running process