The Operating Machine
Processes, Memory, Files & System Control
Central Doctrine
Hardware alone is not enough to operate a modern computer. Algorithms require a master coordinator to execute them. The Operating System is the ultimate manager—allocating memory, scheduling CPU time, controlling devices, organizing files, and enforcing security boundaries so that multiple programs can run simultaneously without destroying each other.
KERNEL →
PROCESSES →
SCHEDULING →
VIRTUAL MEMORY →
PAGING →
FILE SYSTEMS →
INTERRUPTS →
SECURITY
The Internal Chambers
Ontology of Systems Software
CHAMBER 01
What is an OS?
APPLICATIONS
OPERATING SYSTEM
HARDWARE
- The master system software
- Resource, Process, Memory, File, and Device management
- Provides the hardware abstraction and application environment
CHAMBER 02
Why Do We Need It?
- Hardware is too complex for applications to manage directly
- Resource sharing and multitasking
- Protection, standardization, and convenience
CHAMBER 03
Types of OS
BATCH
TIME-SHARE
REAL-TIME
DISTRIBUTED
- Batch, Multiprogramming, Time-sharing
- Real-time (RTOS), Embedded, Mobile
- Desktop, Server, and Distributed systems
CHAMBER 04
OS Components
K
- Kernel, Shell, System-call interface
- Process, Memory, and File-system managers
- I/O subsystem, Network, and Security subsystems
CHAMBER 05
The Kernel
K
- The core privileged software of the OS
- Handles interrupts, scheduling, memory, and devices
- Stays resident in memory at all times
CHAMBER 06
User Mode & Kernel Mode
USER
KERNEL
- Hardware-enforced CPU privilege levels
- Applications cannot directly control hardware
- Mode switching occurs via System Calls and Interrupts
CHAMBER 07
System Calls
APP → OS
- The programmatic API to the Kernel
- Requesting file, process, memory, or device operations
- Crossing the protection boundary safely
CHAMBER 08
The Process
CODE
EXEC→
- Program: Passive file on disk
- Process: Active, running instance in memory
- Contains code, state, memory space, and resources
CHAMBER 09
Process States
NEW
READY
RUN
WAIT
TERM
- New → Ready → Running → Terminated
- Running → Waiting (I/O) → Ready
- Transitions managed by the Scheduler
CHAMBER 10
Process Control Block
PID: 1042
STATE: READY
PC: 0x4FA
REGISTERS
- The data structure the OS uses to track a process
- Stores Process ID, State, Program Counter, CPU registers
- Maintained by the kernel for every active process
CHAMBER 11
Creation & Termination
P
C
C
- Parent processes create Child processes (fork)
- Process hierarchies and exit statuses
- Orphans (parent dies) and Zombies (child dies but status unread)
CHAMBER 12
Context Switching
CPU
- Saving the state of the old process to its PCB
- Restoring the state of the new process from its PCB
- Pure overhead—no actual user work gets done during the switch
CHAMBER 13
CPU Scheduling
- Deciding which process in the Ready Queue gets the CPU
- CPU bursts vs. I/O bursts
- Preemptive (OS interrupts) vs. Non-preemptive (Process yields)
- Criteria: Throughput, Turnaround time, Fairness
CHAMBER 14
Scheduling Algorithms
FCFS
SJF
ROUND ROBIN
PRIORITY
- First-Come First-Served (Simple, starvation possible)
- Shortest Job First (Optimal waiting time, hard to predict)
- Multilevel Feedback Queues (Complex modern approach)
CHAMBER 15
Round Robin
P1
P2
P3
P4
- Every process gets a fixed "Time Quantum"
- Fair allocation, excellent for time-sharing systems
- If quantum is too small: Huge context-switch overhead
CHAMBER 16
Threads
- Lightweight execution units within a process
- Share the same memory address space and open files
- Each has its own Thread ID, PC, and Stack
- User-level vs. Kernel-level threads
CHAMBER 17
Multithreading
SHARED MEMORY
- Concurrent execution within a single application
- Highly responsive, easier resource sharing than IPC
- Risks: Race conditions, Deadlocks, difficult synchronization
CHAMBER 18
Process vs Thread
PROC
VST1T2
- Processes: Isolated memory, high creation/switch cost, safe from each other
- Threads: Shared memory, low creation/switch cost, one crash kills all
CHAMBER 19
Concurrency & Parallelism
CONCUR
PARAL
- Concurrency: Interleaving tasks on a single core (illusion of simultaneous)
- Parallelism: Actually executing tasks simultaneously on multi-core CPUs
CHAMBER 20
Inter-Process Comm (IPC)
- Mechanisms for isolated processes to exchange data
- Shared Memory (fast, requires sync)
- Message Passing, Pipes, Sockets, Signals
CHAMBER 21
Synchronization
CRITICAL SECTION
- Mutual Exclusion: Only one thread in Critical Section
- Mutexes, Semaphores, and Locks
- Ensuring Atomic operations to prevent data corruption
CHAMBER 22
Race Conditions
X = 5
- Timing-dependent bugs from concurrent access
- Occurs when threads read/write shared state without locks
- Causes silent, unpredictable data inconsistency
CHAMBER 23
Deadlock
- Processes frozen waiting for each other's resources
- Requires: Mutual Exclusion, Hold & Wait, No Preemption, Circular Wait
- Strategies: Prevention, Avoidance, Detection, Recovery
CHAMBER 25
Memory Management
- Allocating and deallocating physical memory
- Memory protection (preventing processes reading others' memory)
- Logical vs. Physical address spaces
CHAMBER 26
Virtual Memory
VM
→ MAP →RAM
- Illusion of large, contiguous private memory for each process
- Address translation handled by hardware (MMU) + OS
- Allows executing programs larger than physical RAM
CHAMBER 27
Paging
0
F4
0
F1
- Memory divided into fixed-size Pages (Logical) and Frames (Physical)
- Page Table maps Page Numbers to Frame Numbers
- Eliminates external fragmentation
- TLB (Translation Lookaside Buffer) speeds up translation
CHAMBER 28
Page Replacement
!
P1
P2
- Page Fault: CPU needs a page not currently in RAM
- OS must swap a page in from disk, evicting an old one
- Policies: FIFO, LRU (Least Recently Used), Optimal
- Thrashing: When system spends more time paging than executing
CHAMBER 31
Memory Fragmentation
- External: Free memory exists, but is scattered in small holes (solved by Paging).
- Internal: Allocated block is larger than requested data, wasting space inside the block.
CHAMBER 33
The File System
/
bin
usr
- Logical organization of storage
- Directories, hierarchies, and paths (Absolute/Relative)
- Metadata, attributes, permissions, and free-space tracking
CHAMBER 38
Storage Management
- Mapping logical files to physical disk blocks
- Contiguous, Linked, and Indexed allocation
- Disk fragmentation and scheduling
CHAMBER 39
Device Management
KERNEL
DRIVER
HW CONTROLLER
- OS Device Subsystem
- Drivers: Hardware-specific software translating OS commands to device signals
- Device controllers and hardware abstraction
CHAMBER 42
I/O & Interrupts
CPU
- Interrupt-driven I/O vs. Programmed (polling) I/O
- Devices signal CPU asynchronously when ready
- Interrupt Service Routines (ISR)
CHAMBER 46
User Interfaces
vs
- CLI (Shell) vs. GUI (Desktop Environment)
- Command interpreters, pipes, and redirection
- The layer bridging human intent to system calls
CHAMBER 48
The Boot Process
1. BIOS/UEFI
2. BOOTLOADER
3. KERNEL INIT
4. USER SPACE
- Power on → Firmware initializes hardware
- Bootloader loads Kernel from disk to memory
- Kernel mounts file system and starts init processes
CHAMBER 50
Security & Protection
🔒
- User accounts, Authentication, Authorization
- File permissions and access control
- Principle of least privilege
- Hardware-backed process isolation
CHAMBER 53
Virtualization
VM1
VM2
HOST HW
- Hypervisors simulating hardware for Guest OS
- Virtual CPU, Memory, and Devices
- Complete isolation and resource partitioning
CHAMBER 64
Master OS Map
USER SPACE (Applications)
↓ SYSTEM CALL ↓
KERNEL SPACE (OS)
PROC | MEM | FILE | I/O
↓ DRIVERS ↓
HARDWARE
FINAL CHAMBER
The Bridge to Networks
REALM 09 coordinated the single machine:
HARDWARE → KERNEL → PROCESSES → USERS
↓
But computers become infinitely more powerful
when they communicate.
ONE MACHINE → ROUTERS → GLOBAL NETWORK