03. Operating System Concepts

At the heart of every computer system lies a collection of powerful architectural abstractions designed to turn raw hardware into a programmable, secure, and intuitive environment. this module examines the core conceptual pillars that define modern operating systems.

1. The Process Abstraction

At the foundation of operating system design is the process: an abstraction representing an active program in execution. While a program is a lifeless, passive collection of machine instructions and static data stored on non-volatile media (such as an ELF binary or Windows PE file on an NVMe SSD), a process is a dynamic, living computational entity with an active execution context managed by the kernel.

Process vs. Program: The Core Distinction

A single program can correspond to multiple distinct processes running concurrently. For example, if two users launch separate instances of the text editor nano, or if a user opens three independent terminal shells, each instance constitutes a separate process. Although both instances share the exact same underlying machine code in memory, each maintains completely isolated memory registers, dynamic heap buffers, execution state flags, and private call stacks.

Anatomy of a Process in Memory

When an operating system loads a binary executable into physical RAM to execute, it constructs a private virtual address space organized into standardized logical segments:

0x7FFFFFFFFFFF (High Addresses) Stack Segment Function Frames • Local Variables • Return Pointers Grows Downward Unallocated Virtual Address Space Grows Upward Heap Segment Dynamic Memory (malloc / brk / mmap) BSS Segment (Zero-Initialized Globals) Data Segment (Initialized Globals & Statics) Text Segment (Read-Only Machine Code) 0x000000000000 (Low Addresses)

The Process Control Block (PCB): Cross-Platform Realities

Because CPU cores can execute only one sequence of instructions at any given instant, the operating system kernel maintains a centralized control structure—the Process Control Block (PCB)—to manage identity, ownership, security bounds, and hardware state for every active execution entity.

However, the internal implementation of a PCB varies substantially between operating system families:

Design Dimension Linux / Unix (struct task_struct) Windows NT (EPROCESS / KPROCESS) Microkernels (e.g., seL4 / QNX)
Entity Philosophy Unified scheduler entity. Processes and threads are both represented by task_struct, sharing resources via clone() flags. Strict container abstraction. An EPROCESS represents address space and resources; execution is delegated entirely to threads (ETHREAD). Minimalist capability model. The kernel tracks Thread Control Blocks (TCBs) and capability nodes (Cnodes); process concepts live in user space.
Identification Process ID (PID) and Thread Group ID (TGID). Unique Process ID (UniqueProcessId) and Client ID. Kernel capability references or badge tokens.
Hardware Register Context Stored within kernel stack and thread_struct embedded directly in task_struct. Absent from EPROCESS; saved exclusively inside individual KTHREAD context frames. Stored directly in the hardware-mapped register block of the TCB.
I/O & Object Tracking Zero-indexed file descriptor table (struct files_struct) mapping integers to open file descriptions. Kernel Object Handle Table (ObjectTable) mapping opaque HANDLE pointers with explicit security ACLs. IPC endpoint capabilities and notification slots; no internal device or file tables.
Memory Context Pointer mm_struct pointer referencing the PML4 root and Virtual Memory Areas (VMAs). DirectoryTableBase in KPROCESS storing CR3, alongside a Virtual Address Descriptor (VAD) tree. Page directory capability (VSpace root).

Key Elements Universal to All PCBs

Despite naming differences across kernel architectures, any production operating system maintains the following core invariants inside or associated with its process control tracking:

Process State Transitions: The Three-State Model

Throughout its lifecycle, a process transitions between three core execution states:

  1. Running: The process currently occupies a physical CPU core and its instructions are executing in hardware.
  2. Ready: The process possesses all prerequisites to execute, but is temporarily stopped waiting for the CPU scheduler to allocate a core.
  3. Blocked (Waiting): The process cannot proceed—even if a CPU core is idle—because it is waiting for an external event to finish, such as reading disk sectors, receiving network packets, or waiting on a timer.
READY In Run Queue RUNNING Executing on CPU BLOCKED Waiting for I/O 1. Scheduler Dispatch 2. Timer Expiry (Preempted) 3. Blocked for I/O 4. I/O Completed

Lifecycle Boundaries: The Classical Five-State Model

While the three-state model captures the dynamic scheduling loop on the CPU, production operating systems must also manage process inception, admission control, and resource reclamation upon exit. The Five-State Process Model extends the execution loop by adding formal entry and exit boundaries:

CLASSICAL FIVE-STATE PROCESS LIFECYCLE MODEL Creation → Active Scheduling Core → Termination / Zombie Teardown NEW fork / create Admit READY In Run Queue RUNNING On CPU Core Scheduler Dispatch Timer Preemption BLOCKED I/O / Sleep Block for Event Event Occurred Exit / Kill TERMINATED Zombie

Virtual Memory Realities: The Seven-State Process Model

While the 5-state model accounts for lifecycle boundaries, it implicitly assumes that all active processes reside permanently in physical RAM. In reality, modern systems frequently face memory overcommitment—where the aggregate virtual address spaces of all runnable and blocked processes exceed physical DRAM capacity.

To prevent the system from crashing under memory exhaustion, the operating system introduces a Medium-Term Scheduler (The Swapper). The swapper moves dormant or blocked processes from physical RAM to secondary backing stores (a swap partition, swapfile, or pagefile), introducing two distinct suspended states and giving rise to the classical Seven-State Model:

PRIMARY MEMORY (PHYSICAL RAM - ACTIVE) SECONDARY STORAGE (SWAPFILE / BACKING STORE - SUSPENDED) NEW Created Admit Admit (Overcommit) READY In Memory RUNNING On CPU Core Dispatch Timeout / Preempt BLOCKED In Memory Event Wait Event Occurred Exit / Release TERMINATED Zombie READY / SUSPENDED (On Disk) BLOCKED / SUSPENDED (On Disk) Suspend (Swap Out) Activate (Swap In) Suspend (Swap Out) Activate (Swap In) Event Occurs (While Swapped)

Key Swapping Dynamics in the Seven-State Model

Interactive Walkthrough: Process Lifecycle Engine

Scenario: Database query report execution (PID 4092) under severe memory contention and storage I/O.

CURRENT STATE: READY
RESIDENCE: PHYSICAL DRAM
ACTIVE CPU: NONE (IN QUEUE)
PENDING I/O: NONE
PRIMARY MEMORY (PHYSICAL RAM) READY Run Queue RUNNING CPU Core 1 BLOCKED Wait on I/O
Stage Explanation: Scheduler dispatches PID 4092 onto CPU Core 1
1. What Is Happening (Low-Level Mechanics)
2. Why The System Does This (Design Rationale)
Contextual Definitions & System Concepts

2. Address Spaces & Virtual Memory: Diverse Architectures

To prevent concurrent programs from corrupting one another's data and to decouple software from the limits of physical RAM, operating systems provide the address space abstraction. While contemporary systems predominantly utilize flat, paged virtual memory architectures, operating system design encompasses three distinct structural paradigms:

Memory Architectures Across Operating Systems

Isolated Address Spaces (Linux / Windows NT) Process A 0x0000..0xFFFF Private Page Map Process B 0x0000..0xFFFF Private Page Map Shared Physical DRAM Frames MMU swaps page roots on context switch Single-Level Store (IBM i / OS/400) Universal 128-Bit Virtual Address Space Objects & Data Permanent Storage Active Programs Volatile DRAM Hardware Capability Pointers No file open/close; accessed via direct memory pointer

3. Files & Hierarchical Directories: Diverse Paradigms

The file abstraction provides a persistent, named container for information that survives process termination and power outages. While contemporary developers frequently assume the Unix model—a linear, untyped byte stream anchored in a single unified directory tree—operating system history reflects fundamentally different approaches to structuring persistent storage.

File Structuring Models: Byte Streams vs. Record Datasets

Operating systems categorize the internal structure of files into three primary models:

Namespace Topologies: Unified Trees vs. Per-Volume Roots

How an operating system organizes and accesses multiple physical disk volumes varies dramatically:

POSIX Unified Namespace / /bin /etc /mnt/usb Volume Mounted In-Tree Seamless /dev/sdb1 splice Windows NT Namespace C:\ (NVMe) D:\ (USB) \Windows\System32 \Backups Underlying NT Object Manager: \GLOBAL??\C: → \Device\HarddiskVolume1

Architectural Comparison of File System Implementations

Design Attribute POSIX / Linux (ext4, XFS) Windows NT (NTFS, ReFS) IBM Mainframes (z/OS VSAM)
Data Model Unstructured byte array. Unstructured byte array + Alternate Data Streams (ADS). Structured records (Fixed, Variable, or Key-Sequenced).
Metadata Container Index Node (inode) storing pointers to extent/block maps, size, ownership, and mode flags. Master File Table (MFT) row storing attributes (small files fit directly inside the MFT record). Volume Table of Contents (VTOC) containing Data Set Control Blocks (DSCBs).
Access Security Classic User/Group/Other rwx bits + POSIX 1e ACLs. Granular Security Descriptors (DACLs/SACLs) with inheritance. System Authorization Facility (SAF) / RACF profiles.
Case Sensitivity Strictly case-sensitive (file.txt ≠ File.txt). Case-preserving but case-insensitive by default in Win32. Strictly uppercase alphanumeric characters only.
File Locking Semantics Advisory locking by default (fcntl / flock). Mandatory sharing/locking modes enforced on CreateFile. Exclusive system-enforced enqueue (ENQ) locks per dataset.

4. Input/Output (I/O) Subsystems

The primary role of the I/O subsystem is to bridge the massive speed and interface discrepancies between the high-speed CPU memory bus and heterogeneous external peripherals. Operating systems differ substantially in how they model, schedule, and notify applications of completed I/O transactions:

I/O Notification & Completion Models

Platform Dominant High-Performance Paradigm Hardware Handshake Mechanism
POSIX / Linux Readiness notification (epoll) or shared lockless submission rings (io_uring). Kernel drivers issue MMIO register writes and service hardware IRQs.
Windows NT Asynchronous completion packet queues (I/O Completion Ports - IOCP). I/O Request Packets (IRPs) passed down layered driver stacks.
Microkernels (QNX / seL4) Synchronous message passing (IPC) to user-space driver server processes. Kernel converts IRQs into IPC notification events delivered to driver threads.
IBM Mainframes Autonomous Channel Subsystem executing Channel Command Word (CCW) programs. Specialized auxiliary I/O processors transfer data directly to/from memory.

5. Protection & Security: Authorization Paradigms

Operating system protection mechanisms ensure that executing software accesses only authorized resources (memory segments, files, devices, network endpoints). Broadly, three distinct authorization and boundary paradigms are employed across systems:

Three Core Security Architectures

6. The Command Interpreter: Text, Objects, and Batch Job Control

The command interpreter provides the direct interface through which users and automation scripts interact with operating system facilities. Far from being a uniform shell environment, modern and historical command systems reflect contrasting philosophies of data exchange and execution control:

Command Line Paradigms Compared