Every program you run becomes one or more processes. Process management in operating system design covers how the OS creates processes, tracks their state, shares the CPU between them and cleans up when they end. It is one of the core functions of any operating system.
This guide explains the key ideas: process vs program, process states, the process control block, context switching, scheduling queues, and how processes are created and terminated on Linux and Windows.

Process vs program
A program is a passive file on disk, such as /usr/bin/python3. A process is a program in execution, with its own state. One program can run as many processes at once; for example, several users can run the same editor.
A process includes:
- the program code (text section);
- data, such as global variables;
- a heap for dynamic memory;
- a stack for function calls and local variables;
- CPU state, such as the program counter and registers;
- open files and other resources.
Process states

During its life, a process moves between states:
| State | Meaning |
|---|---|
| New | The OS is creating the process |
| Ready | The process waits for CPU time |
| Running | The process runs on a CPU core |
| Waiting (blocked) | The process waits for I/O or an event |
| Terminated | The process has finished |
For example, a process reading a file moves from running to waiting. When the data arrives, it goes back to ready, and later the scheduler runs it again. Some systems add suspended states, where the OS swaps a process out of memory.
Process control block (PCB)
The OS keeps a data structure for every process, called the process control block. In Linux, it is the task_struct. It stores:
- process ID (PID) and parent ID;
- state and priority;
- saved CPU registers and program counter;
- memory management information;
- open files and I/O status;
- accounting data, such as CPU time used.

Context switching and the dispatcher
When the OS switches the CPU from one process to another, it saves the old process’s state in its PCB and loads the new one’s. This is a context switch. The dispatcher performs the switch, changes to user mode and jumps to the right instruction.
Context switches are pure overhead, so systems try to keep them efficient. The time they take is called dispatch latency.
Scheduling queues
The OS keeps processes in queues:
- the ready queue holds processes waiting for the CPU;
- device queues hold processes waiting for specific I/O.
The CPU scheduler picks the next process from the ready queue. Learn how in our guide to CPU scheduling algorithms.
Process creation
A process creates child processes, which form a tree. On Linux, the first user-space process is usually systemd with PID 1.
On Linux and Unix, creation uses two system calls:
pid_t pid = fork(); // create a copy of the current process
if (pid == 0) {
execlp("ls", "ls", "-l", NULL); // child: replace itself with a new program
} else {
wait(NULL); // parent: wait for the child to finish
}Windows, by contrast, uses a single CreateProcess() call that creates the process and loads the program at once.
Process termination
A process ends normally by calling exit(), or abnormally when it crashes or someone kills it, for example with kill PID on Linux. The parent then collects the exit status with wait(). Until it does, the finished child remains a zombie process. If the parent dies first, the child becomes an orphan, and PID 1 (or a designated “subreaper” process) adopts it.
Useful commands
| Task | Linux | Windows |
|---|---|---|
| List processes | ps aux, top | Task Manager, tasklist |
| Process tree | pstree | Process Explorer |
| End a process | kill PID | taskkill /PID PID |
Related guides
Sources
Running Linux servers in production? Our Linux server hardening & security audit checks configuration, patching, SSH and logging. You can also use our free Linux server hardening checklist, or contact us.
