Process Management
Understanding how programs transform into living processes, their memory architecture, and the lifecycle of computation.
The Soul of Execution
What is a Program?
A Program is simply compiled code sitting on a disk, ready to execute. It is a passive entity.
What is a Process?
A Process is a program under execution. It is active, loaded in main memory, and using CPU resources.
Converting Program to Process
Memory Loading
Load the program and its static data into Main Memory (RAM).
Stack Allocation
Allocate a run-time Stack. Used for local variables, function arguments, and return values.
Heap Allocation
Allocate a Heap for dynamic memory (e.g., malloc in C, new in Java).
PCB Setup
Set up the Process Control Block (PCB) to store metadata like PID and registers.
I/O Descriptors
Initialize standardized descriptors: i/p (taking input), o/p (showing output), and Error Handling.
Final Handoff
OS handoffs control to main() or JVM. Program Counter is set to the entry point.
Attributes & Process Table
Process Table
A centralized data structure where the OS tracks every active process. Think of it as the "Register" for living code.
- Each entry in this table is a PCB.
- Enables OS search/management of specific PIDs.
Attributes
These are features that allow the OS to identify and manage each process uniquely: