Process and Thread Management
Process: a running program — its own address space, file descriptors, and execution context. Thread: a lightweight unit of execution within a process — shares address space but has its own stack and registers. Process states: new → ready → running → waiting → terminated. Context switch: saving and restoring CPU state when switching between processes — typically 1-10 μs. Process creation: fork() (Unix — creates copy of parent process), exec() (replaces process image with new program). Inter-process communication (IPC): pipes, message queues, shared memory, sockets, signals. Threads: POSIX threads (pthreads), kernel threads vs. user threads, many-to-one vs. one-to-one vs. many-to-many models. Concurrency challenges: race conditions, deadlocks (Coffman conditions: mutual exclusion, hold-and-wait, no preemption, circular wait). Synchronization primitives: mutexes, semaphores (Dijkstra), monitors, condition variables, read-write locks. Modern concurrency: async/await (coroutines), actor model (Erlang, Akka), CSP (Go channels), lock-free data structures.
Memory Management
Virtual memory: each process has its own virtual address space — mapped to physical memory by MMU (Memory Management Unit). Paging: virtual memory divided into fixed-size pages (typically 4 KB), physical memory into frames. Page table: maps virtual pages to physical frames — multi-level page tables reduce memory overhead. TLB (Translation Lookaside Buffer): cache for page table entries — critical for performance (TLB miss: ~100 cycle penalty). Page replacement algorithms: FIFO, LRU (Least Recently Used), Clock algorithm, Second Chance. Demand paging: pages loaded only when accessed (page fault) — efficient but causes page faults. Thrashing: system spends more time paging than executing — occurs when working set exceeds physical memory. Huge pages: 2 MB or 1 GB pages — reduce TLB misses for memory-intensive applications. Memory-mapped files: mmap() — map file contents directly into virtual address space. Address Space Layout Randomization (ASLR): randomize memory layout to prevent buffer overflow exploits. Copy-on-write (COW): fork() shares pages until one process writes — efficient process creation.
File Systems
File system: organizes data on storage devices — provides hierarchical namespace, access control, and data integrity. Inodes (Unix): data structure storing file metadata (permissions, timestamps, block pointers) — separate from filename (directory entry). EXT4: default Linux file system — journaling, extents, 1 EB max volume size, backward compatible. XFS: high-performance, 64-bit, scalable — default in RHEL/CentOS, excellent for large files. Btrfs: copy-on-write, snapshots, checksums, compression, RAID — next-gen Linux FS. ZFS (OpenZFS): pooled storage, 128-bit addressing, data integrity (end-to-end checksums), snapshots, deduplication, RAID-Z. NTFS: Windows default — journaling, ACLs, compression, encryption (EFS), symbolic links. APFS: Apple File System — copy-on-write, encryption, space sharing, snapshots. Journaling: write-ahead log prevents corruption after crashes — metadata journaling (EXT4) or full journaling. Log-structured file systems: all writes are sequential appends — excellent for SSDs (F2FS). Distributed file systems: HDFS (Hadoop), GFS (Google), Ceph, GlusterFS — scale across many machines.
Virtualization and Modern OS
Virtualization: running multiple OS instances on shared hardware — Type 1 (bare-metal: VMware ESXi, Hyper-V, KVM) vs. Type 2 (hosted: VirtualBox, VMware Workstation). Hypervisor: manages virtual machines, provides hardware abstraction. KVM: Linux kernel-based virtualization — turns Linux into a Type 1 hypervisor. Hardware-assisted: Intel VT-x, AMD-V — CPU support for efficient virtualization. Containers: lightweight virtualization — share host kernel, isolated namespaces and cgroups. Docker (2013): revolutionized software deployment — containerized applications with consistent environments. Container orchestration: Kubernetes (Google, 2014) — the de facto standard for managing containerized workloads at scale. Microservices: applications decomposed into small, independently deployable services — containerization is the enabling technology. Serverless: cloud functions executed on demand — AWS Lambda, Azure Functions, Google Cloud Functions. Unikernels: minimal OS images compiled with application — LibOS approach, extremely small attack surface. eBPF: extended Berkeley Packet Filter — programmable kernel technology for networking, observability, security. Modern OS evolution: Unix (1969) → BSD, System V → Linux (1991, Torvalds) → Android (2008), ChromeOS, containerized cloud OS.
❓ Frequently Asked Questions
Process: a running program — its own address space, file descriptors, and execution context. Thread: a lightweight unit of execution within a process — shares address space but has its own stack and r...
Virtual memory: each process has its own virtual address space — mapped to physical memory by MMU (Memory Management Unit). Paging: virtual memory divided into fixed-size pages (typically 4 KB), physi...
File system: organizes data on storage devices — provides hierarchical namespace, access control, and data integrity. Inodes (Unix): data structure storing file metadata (permissions, timestamps, bloc...
Virtualization: running multiple OS instances on shared hardware — Type 1 (bare-metal: VMware ESXi, Hyper-V, KVM) vs. Type 2 (hosted: VirtualBox, VMware Workstation). Hypervisor: manages virtual machi...
Try it live
Everything above runs in your browser — open Hash Function Avalanche Visualizer and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.
▶ Open Hash Function Avalanche Visualizer simulation