Day 01Part 03- Operating System Difference between programs and processes.
Day 01Part 03- Operating System Difference between programs and processes.
Contents [hide]
Difference Between Programs and Processes in Operating Systems
In an Operating System (OS), the terms Program and Process are often confused, but they are quite different. Let’s break it down!
What is a Program?
A program is a passive entity that contains a set of instructions written in a programming language (like C, Java, Python) that tells the computer what to do. It is stored on disk or memory but does not execute by itself.
Example: A
.exe
file on your computer is a program.
Key Characteristics:
Stored as a file (not executing).
Does not consume CPU or memory until executed.
Static in nature.
What is a Process?
A process is an active entity that represents a running instance of a program. When a program is executed, the OS loads it into memory (RAM), assigns system resources, and creates a process.
Example: When you open Google Chrome, the program file (
chrome.exe
) runs as multiple processes to handle different tabs.
Key Characteristics:
Requires CPU and memory.
Dynamic in nature (changes during execution).
Has a Process ID (PID) assigned by the OS.
Key Differences Between Program and Process
Feature | Program | Process |
---|---|---|
Definition | A passive set of instructions. | An active execution of a program. |
State | Static (stored in disk). | Dynamic (runs in memory). |
Resource Consumption | Does not use CPU/memory. | Uses CPU, memory, I/O. |
Execution | Needs to be executed. | Already running. |
Example | MS Word.exe file in disk. |
Opened instance of MS Word running in RAM. |
Summary:
- A program is a set of instructions stored on disk (not running).
- A process is an executing instance of a program that uses system resources.
Would you like more details on Process States or Process Scheduling in OS?