1. Program vs. Process
A Program is passive (dead code on a disk). A Process is active (living in RAM).
- When you double-click an executable, the OS loads the code into RAM, assigns it a Process Control Block (PCB), and turns it into a living, breathing Process.
2. The 5-State Lifecycle
Every process in existence travels through this strict flowchart.
- NEW: The PCB is created, but the process is waiting to be admitted into RAM.
- READY: Fully loaded in RAM, patiently waiting in a queue for its turn on the CPU.
- RUNNING: Currently executing instructions on the physical CPU chip.
- BLOCKED (WAITING): The process asked for something slow (like reading a hard drive or waiting for a user to press a key). The CPU kicks it out so it doesn't waste time.
- TERMINATED: Execution finished. The OS destroys the PCB and frees the RAM.
3. Context Switching
The illusion of multitasking.
- If you have 1 CPU core, only ONE process can be RUNNING at a time.
- The OS uses Time Interrupts to violently pause the RUNNING process, save its registers to its PCB, move it back to the READY queue, and load the next process. It does this thousands of times a second.