Lesson 1 of 9 · 24m
Processes Are Resource Containers, Not Running Programs
Separate the program image from the process abstraction and inspect the credentials, file descriptors, memory maps, and parent relationships Linux actually tracks.
The first operating systems mistake I see smart engineers make is saying "the program is running." Programs do not run. Processes run. A program is bytes on disk or in memory; a process is the kernel's container for everything needed to execute those bytes: an address space, credentials, open files, signal state, scheduling state, resource limits, accounting, and a place in the process tree. Once you see the process as a container, half of Linux behavior stops being mysterious.
fork and exec are two different operations
Unix separates creating a process from choosing what it executes:
pid_t pid = fork();
if (pid == 0) {
execl("/bin/echo", "echo", "hello", NULL);
_exit(127);
}fork() duplicates the calling process. execve() replaces the current memory image with a new program while preserving many process properties: PID, open file descriptors without close-on-exec, working directory, user IDs, environment, and resource limits. This split is why shells can open redirections in the child before replacing the child image with the command.
Inspect the container, not the command name
The kernel exposes process state through /proc:
sleep 300 &
pid=$!
printf 'pid=%s\n' "$pid"
tr '\0' ' ' < "/proc/$pid/cmdline"; echo
cat "/proc/$pid/status" | grep -E '^(Name|State|PPid|Uid|Gid|Threads|VmRSS)'
ls -l "/proc/$pid/fd"
readlink "/proc/$pid/exe"/proc/$pid/exe can point to a deleted binary. That is not corruption. It means the inode is still referenced even though the path was unlinked. Attackers and package upgrades both produce this state, which is why incident responders inspect inode targets rather than trusting paths alone.
Parentage explains signals and orphans
Every process except PID 1 has a parent. When a parent exits first, the child is reparented to PID 1 or a subreaper. When a child exits, it becomes a zombie until the parent reaps it with wait(). Zombies consume almost no memory, but they do occupy process-table entries and usually signal a buggy supervisor or shell pipeline.
ps -eo pid,ppid,state,comm | awk '$3 ~ /Z/'Credentials travel with the process
A process has real, effective, saved, and filesystem user IDs, plus supplementary groups. Effective IDs usually control access checks. Capabilities such as CAP_NET_BIND_SERVICE subdivide root powers. Containers complicate the picture with user namespaces, but the kernel still evaluates operations against concrete credentials.
Field notes
- Renaming a binary does not rename the running process image; inspect
/proc/PID/exeand memory maps. pscommand names can lie because processes can overwriteargv[0]; inode-backed evidence is stronger.- Environment variables are inherited copies, not live references back to the parent shell.
- A fork bomb is a process-table and scheduler denial-of-service problem, not a memory problem alone.
Was this lesson helpful?