Ontological Layer: Active Execution Contexts
The Process & Scheduling
How the Operating System Gives Time to Living Programs
The Illusion of Simultaneous Life
A program is passive code stored on a disk. A Process is that code brought to life—an active execution entity assigned memory, security context, and CPU time. Because a single CPU core can only execute one process at a time, the OS must ruthlessly manage a state machine: swapping PCBs in and out of the CPU via Context Switches, utilizing complex Scheduling Algorithms (like Round Robin or SJF) to create the illusion that dozens of programs are running simultaneously.
The 12 Execution Chambers
Ontological Mapping: States, PCBs, and Dispatching
Program → Process
- Program as passive static code
- Process as active execution entity
- Resource ownership changes
- Execution state instantiation
Process Address Space
- Code (Text) Segment
- Data and BSS Segments
- Heap (Dynamic memory)
- Stack (Function calls & locals)
Process States
- New, Ready, Running, Waiting, Terminated
- Scheduler dispatch (Ready → Running)
- Preemption (Running → Ready)
- I/O Blocking (Running → Waiting)
Process Control Block
- The OS data structure for a process
- Process ID (PID) and State
- Program Counter & CPU Registers
- Memory and I/O tracking info
Creation & Termination
- Parent / Child hierarchy
- Fork vs Spawn execution models
- Normal vs Abnormal termination
- Zombie and Orphan processes
Scheduling Fundamentals
- Multiprogramming objective
- Ready Queue management
- The Dispatcher mechanism
- Preemptive vs Non-Preemptive
Scheduling Algorithms
- FCFS (First-Come, First-Served)
- SJF (Shortest Job First) / SRTF
- Priority Scheduling (Starvation/Aging)
- Round Robin (Time Quantum slicing)
Multilevel Scheduling
- Multiple distinct ready queues
- Foreground vs Background priority
- Multilevel Feedback Queue (MLFQ)
- Dynamic priority adjustment
Metrics & Gantt Charts
- Turnaround Time (Completion - Arrival)
- Waiting Time (Turnaround - Burst)
- Response Time vs Throughput
- Visualizing CPU allocation
Threads & Context Switches
- Threads as smallest schedulable units
- Shared Heap/Data vs Private Stacks
- Context Switch (Save old PCB, Load new)
- Pure overhead cost of switching
Multicore & IPC
- Global vs Per-Core scheduling
- Load balancing and CPU Affinity
- Inter-Process Communication (IPC)
- Shared Memory vs Message Passing
12 — The Scheduling Laboratory
We now understand that programs are active, concurrent entities fighting for the CPU. But what happens when these multiple threads or processes try to access the exact same shared memory at the exact same time? This chaos leads us directly into Realm 13: Concurrency, Synchronization & Deadlock.