Part 1 of 7 · 1 min read
Why this page comes first
In this module you will
- Explain the difference between a program and a process.
- Name the five parts of a process's memory and say where each variable of a C program lives.
- Show with a small C program that the stack grows downward and that the heap sits elsewhere.
- Read the memory map of a live process in
/proc/self/maps. - Explain why two processes running the same program do not disturb each other.
Level 0 treated the operating system as a manager of resources. The most important thing it manages is the running program. This page defines that running program, the process, and shows where it lives in memory. Page 2 adds the states a process goes through, and page 3 shows how new processes are made. The main sources are "Operating System Concepts" (OSC), chapter 3, "Operating Systems: Three Easy Pieces" (OSTEP), and "The Linux Programming Interface" (TLPI), chapter 6. Every program here was compiled and run on Linux.
About this example About this example
Real: The C programs, commands and outputs on this page were compiled with gcc -Wall -Wextra -pthread and run on a Linux test machine (2 processors, kernel 6.18, glibc 2.39).
Scripted: The worked traces use small numbers chosen so they can be followed by hand.
Not real: The page simplifies real systems. Actual kernels add more cases, limits and tuning than a short page can show.