study-index.md

🎯 Operating Systems β€” Complete Zero-to-Interview Roadmap

Goal: Master Operating Systems from absolute zero to interview-ready level for top-tier SDE roles (FAANG, Juspay, Uber, Stripe, Microsoft, Startups).
Approach: Deep-dive theoretical rigor + low-level internals + multi-threading/concurrency mastery + practical code + numerical problems + 100+ interview Q&As.
Total Estimated Time: 3-4 weeks of focused study (2-3 hours/day).


πŸ—ΊοΈ Visual Learning Path

Phase 1: OS Core Architecture & Execution Model β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ 01 - OS Basics & Core β”‚ ─────►│ 02 - Process & Thread β”‚ β”‚ Kernel vs User Mode, β”‚ β”‚ Management, Lifecycle, β”‚ β”‚ Syscalls, Interrupts β”‚ β”‚ PCB/TCB, IPC, Models β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ Phase 2: Scheduling & Concurrency Engine β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ 04 - Synchronization β”‚ ◄─────│ 03 - CPU Scheduling β”‚ β”‚ & Concurrency Mastery β”‚ β”‚ Algorithms, Metrics, β”‚ β”‚ Locks, Semaphores, β”‚ β”‚ Gantt Charts, MLFQ, β”‚ β”‚ Deadlocks, Tree-Lockingβ”‚ β”‚ CFS & Multicore β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ Phase 3: Resource Subsystems (Memory & Storage) β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ 05 - Memory Management β”‚ ─────►│ 06 - File Systems & β”‚ β”‚ Paging, TLB, Virtual β”‚ β”‚ Disk Storage β”‚ β”‚ Memory, Allocation, β”‚ β”‚ Inodes, Disk Sched, β”‚ β”‚ Page Replacement, COW β”‚ β”‚ VFS, RAID Levels β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ Phase 4: Battle Testing & Interview Readiness β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ 07 - Interview Prep, Scenarios & 100+ Question Bank β”‚ β”‚ Tricky edge cases, real-world high concurrency scenarios β”‚ β”‚ (epoll, zero-copy, false sharing, LeetCode concurrency) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“š Module Overview

#Module FileCore Topics CoveredPractical FocusEst. Time
01OS Basics & Core ArchitectureWhat is an OS, Dual-Mode CPU execution (Ring 0 vs Ring 3), System Calls under the hood (trap, dispatch table), Hardware vs Software Interrupts, IDT, Polling vs Interrupt-driven I/O, Boot sequence (BIOS/UEFI β†’ Kernel init).Writing assembly syscalls, understanding kernel mode transitions, tracing syscalls with strace.2 days
02Process Management & IPCProcess memory layout (Text, Data, BSS, Heap, Stack), PCB, 5/7-State process lifecycle, Multiprogramming vs Multitasking vs Multiprocessing vs Multithreading, Thread models (1:1, N:1, M:N), Context Switching internals, fork(), COW, exec(), wait(), Zombie vs Orphan processes, IPC (Pipes, Shared Memory, Message Queues, Unix Domain Sockets).Implementing IPC channels in C/C++, building process supervisors, handling zombie reapers.3 days
03CPU Scheduling AlgorithmsCPU/IO burst cycles, Preemptive vs Non-preemptive scheduling, Scheduling metrics (TAT, WT, RT), FCFS & Convoy Effect, SJF, SRTF, Priority Scheduling & Aging, Round Robin (Quantum tuning), HRRN, Multilevel Feedback Queue (MLFQ), Linux Completely Fair Scheduler (CFS, vruntime, Red-Black tree), Multicore scheduling (NUMA, affinity, cache balancing).Solving numerical Gantt chart problems, implementing RR & MLFQ simulators.3 days
04Synchronization & Concurrency MasteryRace conditions, Critical section requirements (Mutual Exclusion, Progress, Bounded Waiting), Hardware primitives (CAS, Test-And-Set, Memory Barriers, MESI cache coherence), Peterson's Algorithm, Mutex vs Semaphore (Binary/Counting), Spinlocks vs Sleep locks, Monitors & Condition Variables, Read-Write Locks (Reader vs Writer preference), Classical problems (Producer-Consumer, Readers-Writers, Dining Philosophers, Sleeping Barber), Deadlocks (4 Coffman conditions, Prevention, Banker's Algorithm avoidance, RAG detection, Recovery), Priority Inversion & PIP, Juspay Tree-of-Space fine-grained locking & Lock-Free concurrency.Implementing thread-safe queues, custom locks from scratch, lock-free stacks, multi-threaded tree locking.5 days
05Memory Management & Virtual MemoryLogical vs Physical addressing, MMU, Base/Limit registers, Contiguous allocation (First/Best/Worst Fit), Internal vs External fragmentation, Buddy Allocator & Slab Allocator, Paging internals (Page tables, Multi-level page tables, Inverted page tables, PTBR), TLB (Hit/Miss, EAT calculations, TLB Shootdown), Segmentation, Virtual Memory & Demand Paging, Page Fault Handling cycle, Page Replacement (FIFO, Belady's Anomaly, LRU, Optimal, Clock/Second-Chance, LFU/MFU), Thrashing & Working Set Model, Copy-On-Write (COW), mmap.Numerical page table & EAT calculations, implementing LRU/Clock algorithms, debugging memory leaks.4 days
06File Systems & Storage ManagementFile concepts & Inode data structure (Direct/Indirect pointers), Hard links vs Soft/Symbolic links, Directory implementations, File allocation methods (Contiguous, Linked list, FAT, Indexed, Inode-based), Free space management (Bitmaps, Linked Lists), Virtual File System (VFS) abstraction, Journaling & WAL crash recovery (ext3/ext4), Disk geometry, Disk Scheduling (FCFS, SSTF, SCAN, C-SCAN, LOOK, C-LOOK), RAID levels (0, 1, 5, 6, 10, Parity math, rebuild overhead).Calculating disk head movements, file allocation block pointers, designing basic file system metadata.3 days
07Interview Prep, Scenarios & 100+ Q&A Bank100+ categorised high-yield SDE questions with deep answers, High-concurrency system internals (select/poll/epoll/kqueue, Reactor pattern, Zero-copy sendfile, CPU cache line false sharing, Goroutines vs Java Virtual Threads vs Native threads), What happens when you press a key/run a command/stream music while compiling, LeetCode Concurrency problem solutions with online links & GATE numerical practice bank.Mock interview drills, high-concurrency debugging, LeetCode concurrency problems.4 days

πŸ›οΈ The Core Pillars of Operating Systems

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ OPERATING SYSTEM CORE PILLARS β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ VIRTUALIZATION β”‚ CONCURRENCY β”‚ PERSISTENCE β”‚ SECURITY & ISOLATION β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ Virtual CPU β”‚ Multi-threading β”‚ File Systems β”‚ Dual-Mode Rings (0 & 3) β”‚ β”‚ (Time-sharing, β”‚ Synchronization β”‚ Inodes & Buffers β”‚ Page Table Permissions β”‚ β”‚ Scheduling, β”‚ Mutual Exclusion β”‚ Journaling / WAL β”‚ Sandboxing / Namespaces β”‚ β”‚ Context Switch) β”‚ Deadlock Handling β”‚ Disk Scheduling β”‚ Memory Isolation β”‚ β”‚ β”‚ Lock-Free & Atomicsβ”‚ RAID Redundancy β”‚ System Call Gateways β”‚ β”‚ Virtual Memory β”‚ β”‚ β”‚ β”‚ β”‚ (Paging, TLB, β”‚ β”‚ β”‚ β”‚ β”‚ Address Spaces) β”‚ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ’‘ How to Master This Material

  1. Active Coding & Tracing: Don't just read definitions. Trace every system call, draw memory maps, and write multi-threaded code snippets locally.
  2. Solve Every Numerical: CPU scheduling tables, EAT calculations, Page table size math, and Disk head movements are guaranteed easy points in interviews if you practice the step-by-step arithmetic.
  3. Master the "Why" and "Trade-offs":
    • Why not have infinite time slices in Round Robin?
    • Why does Belady's Anomaly happen with FIFO but never with LRU?
    • Why does fine-grained locking increase throughput but risk deadlocks?
    • Why does epoll scale to 100k connections while select degrades at 1024?
  4. Special Focus on High-Concurrency & Multi-Threading:
    • If preparing for Juspay, Uber, HFTs, or High-Scale Backend teams, dedicate 40% of your time to Module 04 (Synchronization) and Module 07 (Scenarios & Concurrency). You will be asked to design thread-safe trees, implement custom locks without library mutexes, and prevent race conditions at scale.

πŸ“‹ Interview Readiness Checklist

Track your progress across all core competencies:

πŸ”° Architecture & Process Fundamentals

  • Can explain User Mode vs Kernel Mode and why the CPU hardware mode bit is critical
  • Can trace a System Call step-by-step: trap instruction β†’ dispatch table β†’ kernel handler β†’ sysret
  • Understand hardware interrupts vs software traps vs exceptions
  • Can diagram the process memory layout (Text, Data, BSS, Heap, Stack)
  • Understand Process Control Block (PCB) fields and the exact steps of a Context Switch
  • Know the difference between Multiprogramming, Multitasking, Multiprocessing, and Multithreading
  • Can explain fork(), Copy-on-Write (COW), exec(), and how Zombie and Orphan processes occur
  • Understand all IPC mechanisms (Pipes, Shared Memory, Message Queues, Sockets) and their performance trade-offs

⚑ CPU Scheduling

  • Can calculate Turnaround Time, Waiting Time, and Response Time across FCFS, SJF, SRTF, RR, Priority, HRRN
  • Understand the Convoy Effect in FCFS and how to mitigate it
  • Can explain the Round Robin time quantum dilemma (too small = context switch overhead, too large = FCFS)
  • Know how Multilevel Feedback Queue (MLFQ) prevents starvation and penalizes CPU-heavy tasks
  • Understand how Linux CFS uses vruntime and Red-Black trees for $O(\log N)$ / $O(1)$ scheduling

πŸ”’ Concurrency, Synchronization & Deadlocks

  • Can define a Race Condition and Critical Section with real-world code examples
  • Know the 3 requirements for critical section solutions: Mutual Exclusion, Progress, Bounded Waiting
  • Understand atomic hardware instructions: Compare-And-Swap (CAS), Test-And-Set, Memory Barriers
  • Deeply understand Mutex vs Semaphore (Binary vs Counting) and who is allowed to unlock/signal
  • Can implement and explain solutions for Producer-Consumer, Readers-Writers, and Dining Philosophers
  • Know the 4 Coffman Deadlock conditions and how to prevent each one
  • Can run Banker's Algorithm by hand to find safe sequences and evaluate allocation requests
  • Understand Priority Inversion and how Priority Inheritance Protocol (PIP) resolves it
  • Can design fine-grained per-node locking strategies (Juspay Tree-of-Space style)

🧠 Memory Management & Virtual Memory

  • Understand Logical vs Physical addresses, MMU address translation, and Base/Limit registers
  • Know the difference between Internal and External fragmentation and how Paging eliminates external fragmentation
  • Can calculate Page Table sizes for single-level and multi-level paging schemes
  • Understand TLB Hit/Miss mechanics, Effective Access Time (EAT), and TLB shootdowns
  • Can walk through a Page Fault interrupt cycle from page-table invalid bit to disk fetch to restart
  • Can solve Page Replacement problems using FIFO, LRU, Optimal, and Clock algorithms
  • Understand Belady's Anomaly and why Stack algorithms (like LRU) are immune to it
  • Know what Thrashing is, what causes it, and how the Working Set Model prevents it
  • Understand how mmap and Copy-on-Write (COW) optimize process creation and file I/O

πŸ’Ύ File Systems & Disk I/O

  • Understand Inodes, direct/indirect data block pointers, and file allocation methods
  • Know the exact difference between Hard Links and Soft (Symbolic) Links
  • Understand Journaling (Write-Ahead Logging) and how file systems recover from sudden power loss
  • Can calculate total head movement for Disk Scheduling algorithms (SSTF, SCAN, C-SCAN, LOOK, C-LOOK)
  • Know RAID levels (0, 1, 5, 6, 10), their redundancy guarantees, performance, and rebuild overheads

πŸš€ Advanced Engineering Scenarios

  • Can explain how I/O multiplexing works: select vs poll vs epoll ($O(N)$ vs $O(1)$ readiness notifications)
  • Understand Zero-Copy data transfers (sendfile(), DMA, bypassing user-space buffer copies)
  • Can identify False Sharing in CPU L1/L2 cache lines and how to fix it with cache line padding
  • Know the exact sequence of events when typing a shell command, pressing a keyboard key, or streaming audio while compiling

Let's begin with Module 01: OS Basics & Core Architecture!