Processes vs Programs
In the context of operating systems, the terms “program” and “process” are often used, but they do not mean the same thing. Understanding the difference between the two is essential to learning how the OS manages tasks and system resources.
What is a Program?
A program is a passive set of instructions written in a programming language (like C, Python, or Java). It is stored in a file on your disk and does nothing until it is executed.
Key Characteristics:
- It is static—just code stored in memory or on disk.
- It does not use CPU, memory, or I/O resources by itself.
- Examples:
notepad.exe
,chrome.exe
,calculator.py
.
You can think of a program as a recipe written on paper. Until someone follows it step by step (executes it), it does not produce anything.
What is a Process?
A process is an active execution of a program. Once a program starts running, it becomes a process and receives resources from the OS, such as memory, CPU time, and file handles.
Key Characteristics:
- It is dynamic—it runs, consumes resources, and eventually ends.
- A single program can run as multiple processes at the same time (e.g., opening two instances of a browser).
- Each process is assigned a unique Process ID (PID) and has its own address space and execution state.
Using the earlier analogy, a process is like someone cooking from the recipe—actively following instructions and using ingredients (resources).
Key Differences Between Program and Process
Aspect | Program | Process |
---|---|---|
Nature | Passive (code on disk) | Active (executing instance) |
State | Static | Dynamic |
Existence | Stored in secondary memory | Lives in RAM (main memory) during execution |
Resource usage | No resources used by itself | Requires CPU, memory, I/O, etc. |
Multiplicity | One copy on disk | Can create multiple processes |
Lifecycle | Has no lifecycle | Goes through creation, execution, termination |
Example
- A text editor program like Notepad exists on your computer.
- When you open it, it becomes a process.
- If you open it again, now you have two processes running the same program.
Summary
A program is just a set of instructions, while a process is the actual execution of those instructions by the computer. The operating system is responsible for creating, managing, and terminating processes, not programs. This distinction is fundamental for understanding how multitasking, scheduling, and resource allocation work in any operating system.