1. Introduction
The concept of a process lies at the very heart of operating system design. Almost every major operating system function—such as CPU scheduling, memory management, synchronization, resource allocation, and inter-process communication—is built around the notion of a process.
While a program represents a static collection of instructions stored on secondary storage, a process represents the dynamic execution of those instructions within the system.
A process is therefore not simply a piece of code. It is an active computational entity that contains:
Executing instructions
Current execution state
Memory allocations
System resources
Scheduling information
Modern operating systems are designed to execute multiple processes concurrently, making process management one of the most important responsibilities of the OS.
A rigorous understanding of the process concept is essential because virtually every advanced operating system mechanism ultimately operates on processes.
Why Processes Are Needed
Suppose a program existed only as code stored on disk.
The operating system would have no information about:
Which instruction is currently executing
What memory is being used
Which files are open
What resources are allocated
The concept of a process provides this missing execution environment.
Thus:
A process transforms a passive program into an active executing entity.
2. Definition of a Process
A process is formally defined as:
A program in execution, including its current activity, execution context, and associated resources.
This definition emphasizes that a process consists of much more than executable code.
A complete process contains three major components:
Program Code
The instructions that define the program's behavior.
Examples:
Browser executable
Text editor executable
Database server executable
Execution Context
The information required to continue execution correctly.
Examples:
Program Counter
CPU Registers
Stack Pointer
Associated Resources
Resources allocated by the operating system.
Examples:
Memory
Open files
Network connections
I/O devices
Together, these components create the complete execution environment of the process.
Process as a Dynamic Entity
A process continuously changes during execution.
Examples of changing attributes:
Program counter advances
Register values change
Memory allocations grow
Files are opened and closed
This dynamic nature distinguishes a process from a program.
3. Process vs Program
The distinction between a program and a process is one of the most important concepts in operating systems.
Although the terms are often used interchangeably in everyday conversation, they represent fundamentally different concepts.
| Feature | Program | Process |
|---|---|---|
| Nature | Passive | Active |
| Stored In | Secondary Storage | Main Memory |
| Execution | Not Executing | Executing |
| State Information | None | Maintains State |
| Resource Usage | No Resources Allocated | Uses Resources |
| Lifetime | Until Deleted | Exists During Execution |
Program
A program is a collection of instructions stored on disk.
Examples:
Chrome.exe
Calculator.exe
Python script
Characteristics:
Static
Passive
No execution state
A program alone cannot perform any computation.
Process
A process is the execution instance of a program.
Characteristics:
Dynamic
Active
Uses system resources
Multiple processes may originate from the same program.
Example:
Google Chrome Program
↓
Chrome Process 1
Chrome Process 2
Chrome Process 3
Each process maintains:
Independent execution state
Independent memory
Independent resources
Program-to-Process Transformation
A program becomes a process when:
Program loaded into memory
Execution context initialized
CPU begins execution
Thus:
Program + Execution Context + Resources = Process
4. Components of a Process
A process consists of multiple components that collectively define its execution environment.
These components can be categorized into:
Process Address Space
Execution Context
Process Resources
4.1 Process Address Space
Each process receives its own virtual address space.
The address space contains all memory required for execution.
A typical process memory layout appears as:
High Address
+----------------------+
| Stack |
| (grows downward) |
+----------------------+
| |
| Heap |
| (grows upward) |
+----------------------+
| Data Segment |
+----------------------+
| Text Segment |
+----------------------+
Low Address
Each region serves a specific purpose.
4.1.1 Text Segment
The Text Segment contains:
Executable instructions
Program machine code
Characteristics:
Usually read-only
Loaded directly from executable file
Advantages:
Prevents accidental modification
Allows sharing among processes
Example:
Compiled instructions of a C program
4.1.2 Data Segment
Stores:
Global variables
Static variables
Example:
int counter = 100;
The variable counter resides in the Data Segment.
Characteristics:
Exists throughout process lifetime
Accessible globally
4.1.3 Heap
The Heap is used for:
Dynamic memory allocation
Memory is allocated during runtime using:
malloc()
calloc()
realloc()
new
Characteristics:
Flexible size
Managed dynamically
Grows upward
Heap memory remains allocated until:
Explicitly freed
Process terminates
4.1.4 Stack
The Stack stores:
Function calls
Local variables
Return addresses
Function parameters
Characteristics:
Automatic allocation
Automatic deallocation
Grows downward
The stack plays a critical role in:
Function execution
Recursive calls
Program control flow
4.2 Execution Context
The execution context represents the current computational state of the process.
Without this information:
Execution cannot resume correctly after interruption.
The operating system saves and restores this context during:
Context switching
Interrupt handling
Process scheduling
Program Counter (PC)
The Program Counter stores:
Address of the next instruction to execute
The PC allows the CPU to continue execution from the correct location.
Example:
Instruction 100
Instruction 101 ← PC
Instruction 102
CPU Registers
Registers store:
Temporary values
Intermediate computations
Function parameters
Examples:
General-purpose registers
Accumulator registers
Registers change continuously during execution.
Stack Pointer (SP)
The Stack Pointer identifies:
Current top of the stack
Used for:
Function calls
Local variable access
Return operations
Processor Status Information
Stores:
Condition flags
Execution mode
Interrupt status
Together these elements form the complete execution context.
Importance of Execution Context
When the operating system performs a context switch:
Process A
↓
Save Context
Load Context
↓
Process B
Execution can later resume precisely where it stopped.
4.3 Process Resources
Processes require resources beyond memory and CPU state.
Examples include:
Open Files
Files currently in use.
Examples:
Documents
Databases
Configuration files
I/O Devices
Processes may access:
Printers
Disks
Keyboards
Network interfaces
Memory Allocations
The operating system tracks:
Heap memory
Shared memory
Virtual memory mappings
Signals and Signal Handlers
Processes may receive signals such as:
SIGINT
SIGTERM
SIGKILL
Signal handlers determine how the process responds.
Network Resources
Processes may own:
Sockets
Network connections
Communication channels
5. Process as an Execution Unit
A process is the fundamental unit of execution recognized by the operating system.
The scheduler allocates CPU time to:
Processes
rather than directly to programs.
Each process represents an independent unit of work.
Key Properties
Independent Execution
Processes execute independently of one another.
Own Address Space
Each process has separate memory.
Resource Ownership
Processes own:
Files
Memory
Devices
Concurrent Execution
Multiple processes can make progress simultaneously.
Schedulable Entity
Processes are the entities managed by CPU scheduling algorithms.
6. Multiple Processes and Concurrency
Modern operating systems execute many processes concurrently.
Examples:
Browser
Text Editor
Music Player
Antivirus
System Services
may all run simultaneously.
Conceptual Representation
Time →
P1: ███ ███ ███
P2: ███ ███
P3: ███ ███
The CPU rapidly switches among processes.
Single-Core Systems
Only one process executes at a given instant.
However:
Context switching occurs rapidly
Users perceive simultaneous execution
This phenomenon is called:
Concurrency
Multi-Core Systems
Multiple processes may actually execute simultaneously.
This is known as:
Parallelism
7. Process Creation (Conceptual View)
A process comes into existence through process creation mechanisms provided by the operating system.
Common causes include:
User-Initiated Creation
User launches:
Browser
Editor
Application
Parent Process Creation
Existing process creates another process.
Examples:
fork()
CreateProcess()
System Initialization
Operating system starts essential services during boot.
Creation Activities
The operating system performs:
PCB creation
PID assignment
Memory allocation
Context initialization
Scheduling setup
The process then enters the system ready for execution.
8. Process Hierarchy
Processes often exist in hierarchical relationships.
A process may create child processes.
Example:
Parent Process
|
+---- Child Process
|
+---- Grandchild Process
This creates:
Process Trees
Benefits of Process Hierarchy
Resource tracking
Process organization
Easier management
Controlled termination
Root Process
In Linux systems:
init (historically)
systemd (modern)
acts as the root of the process tree.
All processes ultimately descend from this root process.
9. Process States (Preview)
A process does not execute continuously.
Instead, it transitions among several states.
Common states include:
Ready
Process prepared to execute.
Waiting for CPU allocation.
Running
Currently executing on CPU.
Waiting
Blocked while waiting for:
I/O completion
Resource availability
External events
Terminated
Execution completed.
Resources released.
The operating system scheduler manages transitions between these states.
10. Key Conceptual Insights
10.1 Process is More Than Code
A process contains:
Program instructions
Execution context
Memory
Resources
Therefore:
A process is an execution environment, not merely a program.
10.2 Isolation
Modern operating systems isolate processes from one another.
Each process typically has:
Independent address space
Independent execution state
Benefits:
Security
Reliability
Stability
One process generally cannot directly access another process's memory.
10.3 Context is Critical
The ability to suspend and resume execution depends entirely on preserving process context.
The operating system saves:
Program Counter
Registers
Stack information
during context switches.
Without context preservation:
Multitasking would be impossible.