Processes in an Operating System
A process is a program in execution: a program loaded into memory, given CPU time, and tracked by the OS as an independent, isolated unit. Unlike the static program file on disk, each process has its own memory space, made up of text (code), data, heap and stack regions, plus bookkeeping the OS maintains for it.
A program is a passive file sitting on disk, a list of instructions that does nothing on its own. A process is that program actually running: loaded into memory, given CPU time, and tracked by the OS as an independent, isolated unit of execution.
What makes up a process
When the OS creates a process, it sets up several distinct memory regions for it:
- Text (code) segment: the actual program instructions, typically read-only.
- Data segment: global and static variables with values fixed at compile time.
- Heap: dynamically allocated memory the program requests while running (via
mallocin C,newin C++, and equivalents in other languages), which grows and shrinks as needed. - Stack: local variables, function call information, and return addresses, growing and shrinking automatically as functions are called and return.
Alongside this memory, the OS maintains bookkeeping about the process (covered in depth in the separate Process Control Block article): its current state, its process ID, the CPU register values it needs restored when it's scheduled to run again, and which resources (open files, network connections) it owns.
The process lifecycle
A process moves through a small set of states over its life: new (being created), ready (waiting for the CPU to become available), running (actually executing on a CPU right now), waiting/blocked (paused because it's waiting on something slow, like disk I/O, and can't proceed until that completes), and terminated (finished, either normally or due to an error). A running process only ever leaves the running state for one of two reasons: it voluntarily starts waiting on something (blocked), or the scheduler preempts it to give another process a turn (back to ready).
A concrete example
Open a text editor twice, as two separate windows. Even though both are running the exact same program file from disk, the OS creates two entirely separate processes: each gets its own independent memory (its own heap, its own stack), its own process ID, and its own tracked state. Typing in one window and crashing that instance has zero effect on the other window's process, they're fully isolated from each other even though they started from the identical program.
Where this matters in real systems
Every time you open an application, whether it's a browser tab (in browsers like Chrome that use one process per tab specifically for isolation and crash containment) or a background service, the OS is creating and managing exactly this kind of independent process. Tools like Linux's ps or Windows' Task Manager are directly showing you the OS's live list of processes and which state each one is currently in.
What interviewers actually ask about processes
- "What's the difference between a program and a process?" A program is a static file on disk containing instructions; a process is that program actually loaded into memory and running, with its own isolated memory and OS-tracked state.
- "What are the main states a process moves through?" New, ready, running, waiting/blocked, and terminated.
- "Why do two instances of the same program get separate processes instead of sharing one?" For isolation: separate memory means a crash or bug in one instance can't directly corrupt or access the other's data.
- "What memory regions make up a process?" Text (code), data (global/static variables), heap (dynamic allocation), and stack (local variables and call information).
Key takeaways
- A process is a program actually in execution, with its own isolated memory and OS-tracked state, distinct from the static program file.
- Its memory is organized into text, data, heap, and stack segments.
- A process moves through new, ready, running, waiting, and terminated states over its lifetime.
- Two instances of the same program still get fully separate, isolated processes.
More in Process Management
Browse all Operating Systems topics
Log in to save which topics you've read across every subject.
Frequently asked questions
What's the difference between a program and a process?
A program is a static file on disk containing instructions; a process is that program actually loaded into memory and running, with its own isolated memory and OS-tracked state.
What are the main states a process moves through?
New, ready, running, waiting/blocked, and terminated.
Why do two instances of the same program get separate processes instead of sharing one?
For isolation: separate memory means a crash or bug in one instance can't directly corrupt or access the other's data.
What memory regions make up a process?
Text (code), data (global/static variables), heap (dynamic allocation), and stack (local variables and call information).