CS fundamentals

Operating Systems Essentials

Processes, threads, scheduling, memory, files and deadlocks explained for interviews and real systems.

  • Handwritten-style
  • Diagrams and tables
  • Worked examples

Who this notebook is for

Students and freshers preparing for campus and off-campus rounds, and engineers who want the operating system basics behind real systems. No prior knowledge is assumed.

What you will be able to do

  • Explain how a process differs from a thread and what a context switch costs
  • Work out CPU scheduling and page replacement answers by hand
  • Spot the four conditions of a deadlock and say how to break each one
  • Describe how virtual memory, paging and file systems work in simple words

What's inside

Pick a chapter and the notebook opens right there.

  1. Architecture, Dual-Mode & SyscallsKernel vs user mode (Ring 0 vs 3), hardware traps & interrupts, interrupt vector table, fast syscall assembly, monolithic vs microkernel architecturesStart here
  2. Process Lifecycle, PCB & Context Switch5-state process lifecycle, PCB task_struct anatomy, register saving, fork() Copy-on-Write, execve() memory overlay, TLB flush context switch costsStart here
  3. Threads & Concurrency ModelsProcess vs thread memory layouts, user-level vs kernel- level threads, M:1, 1:1, M:N threading, POSIX pthreads lifecycle, thread pool architecturesStart here
  4. CPU Scheduling AlgorithmsPreemptive vs non-preemptive scheduling, FCFS convoy effect, SJF & SRTF proof of optimality, Round Robin quantum tuning, MLFQ & Linux CFS virtual runtimeStart here
  5. Synchronization, Mutexes & SemaphoresRace conditions, critical section problem, Peterson's algorithm, atomic Test-and-Set & CAS, counting vs binary semaphores, futex kernel mechanicsStart here
  6. Deadlocks & Banker's Algorithm4 Coffman conditions, Resource Allocation Graphs (RAG), Banker's algorithm safety verification, deadlock prevention, detection & recoveryStart here
  7. Memory Management & PagingContiguous allocation vs fragmentation, Paging hardware, MMU translation, Two-level page tables, TLB hit/miss latency math, Inverted page tablesStart here
  8. Virtual Memory & Page ReplacementDemand paging, Page fault hardware exception sequence, FIFO replacement & Belady's Anomaly, Optimal replacement, Clock algorithmStart here
  9. Thrashing & Working Set DynamicsThrashing root causes, Effective Memory Access Time (EMAT) degradation, Working Set Model, Page Fault Frequency (PFF) control, Swap managementStart here
  10. Secondary Storage & Disk SchedulingMagnetic HDD mechanics, NVMe SSD flash wear leveling, FCFS, SSTF, SCAN (Elevator), C-SCAN, and Linux blk-mq multi-queue I/O schedulersStart here
  11. File Systems & Inode ArchitectureVFS abstraction layer, Unix Inode anatomy, direct/indirect block pointers, directory hash trees, Ext4 journaling vs XFS allocationsStart here
  12. I/O Subsystems & Event-Driven ArchitectureProgrammed I/O vs DMA controllers, select() vs poll() vs epoll() O(1) event loops, Level vs Edge triggered I/O notificationStart here
  13. Kernel Memory: Buddy & Slab AllocationPhysically contiguous memory requirements, Buddy System power-of-two coalescing, Slab Allocator object caches (SLUB), zero external fragmentationStart here
  14. Page Cache, Writeback & SwappingLinux Page Cache unified buffering, dirty page writeback daemons, pdflush/flusher threads, swap space mechanics, swappiness tuningStart here
  15. Real-Time OS & Multiprocessor SystemsHard vs soft real-time constraints, Rate Monotonic & Earliest Deadline First (EDF), Priority Inversion & PIP, SMP vs NUMA memoryStart here
  16. Virtualization & Container InternalsType-1 vs Type-2 Hypervisors, 7 Linux Namespaces (PID, NET, MNT, USER), Cgroups v2 resource regulation, OverlayFS union filesystems, OCI runtime runcStart here
  17. Security, Permissions & System ProgrammingPOSIX permissions & umask math, SUID/SGID privilege escalation, Buffer overflow attacks & ASLR/DEP mitigations, Signals & IPCStart here
  18. FAANG OS Drills & Master Cheat SheetTop 10 High-frequency interview drills, complete mathematical formula cheat sheet, Linux syscall reference, diagnostics (top/vmstat/strace), readiness matrixStart here

Practice this

Put it to work on LakeBench.

Common questions

Do I need to know programming before this notebook?
Basic programming helps, but every idea starts from a plain example. You will see small diagrams and traces before any formula.
Is this enough for the operating systems questions in placements?
It covers the topics those rounds ask most, with worked numerical examples for scheduling, paging and disk scheduling, and a final chapter of interview drills.
Can I read a sample before I commit?
Yes. The contents pages and the first pages of every notebook can be read online, so you can judge the style before going further.

More in CS fundamentals

All notebooks