Operating Systems
Processes, memory, scheduling, and the kernel abstractions every program sits on.
Topics in this field: 43
- What is an OS? — The program that multiplexes hardware and offers processes a usable machine.
- Kernel — The privileged core of the OS: syscalls, scheduling, virtual memory, drivers.
- System Calls — The trap into the kernel: the only legal way a user program asks for privileged work.
- User Mode — Unprivileged execution. Page faults and syscalls are how you leave it.
- Kernel Mode — Privileged execution: the CPU will honor instructions that touch control registers and I/O.
- Processes — An OS abstraction: address space, at least one thread, and a pile of kernel metadata.
- Threads — A schedulable execution context. Threads in one process share an address space.
- Process States — New, ready, running, waiting, terminated — and the events that move a process between them.
- Context Switching — Saving one thread's registers and loading another's so the CPU can change jobs.
- CPU Scheduling — The policy that picks the next ready thread. Fairness, latency, and throughput trade off.
- FCFS — First-come, first-served. Simple, convoy-prone, no preemption required.
- SJF — Shortest job first. Optimal average waiting time if you magically know run times.
- Round Robin — Time slices in a cycle. The quantum is the whole design.
- Priority Scheduling — Run the highest-priority ready thread. Starvation and aging come with it.
- Synchronization — Coordinating threads that share state so the result could have been sequential.
- Race Conditions — When the result depends on an unlucky interleaving of concurrent accesses.
- Critical Sections — Code that must run as if atomic with respect to other threads touching the same data.
- Mutex — Mutual exclusion: at most one holder. The lock you actually want most of the time.
- Semaphore — A counter with wait/signal. Mutexes are semaphores of 1; producer-consumer uses more.
- Monitors — A language-level construct: a mutex plus condition variables bundled with the data.
- Deadlocks — A cycle of waits. Coffman conditions, detection, and the ways out.
- Deadlock Prevention — Break a Coffman condition so a cycle cannot form: no hold-and-wait, preemption, ordering.
- Deadlock Avoidance — Admit a request only if the resulting state is safe. Banker's algorithm is the classic.
- Banker's Algorithm — Dijkstra's safety algorithm: pretend to allocate, see if a finish order exists.
- Memory Management — How the OS carves physical memory for processes: allocation, protection, sharing.
- Paging — Fixed-size pages and frames. The idea that makes virtual memory practical.
- Segmentation — Variable-sized logical regions (code, heap, stack) with base and limit.
- Virtual Memory — Each process sees its own address space, backed by RAM and disk as needed.
- Page Tables — The map from virtual page to frame (or disk). Multi-level to keep them sparse.
- TLB — A cache of page-table entries so every load does not walk the page table.
- Page Replacement — Which resident page to evict on a fault. The policy is the whole game.
- LRU — Replace the page unused for the longest time. Stack algorithms and clock approximations.
- FIFO Replacement — Evict the oldest page. Belady's anomaly is the interview sting.
- Thrashing — When the working set does not fit, the system spends its time paging, not computing.
- File Systems — The on-disk (and in-memory) structures that turn bytes into files, directories, and mounts.
- Disk Scheduling — FCFS, SSTF, SCAN — algorithms from the HDD era that still show up in interviews.
- I/O — How the kernel talks to devices: programmed I/O, interrupts, DMA, block vs character.
- Interrupts (OS) — The kernel's view: interrupt context, bottom halves, and why you cannot sleep in a handler.
- Signals — Software interrupts to a process: SIGINT, SIGCHLD, handlers, and async-signal-safety.
- IPC — Pipes, sockets, shared memory, message queues — how processes exchange data.
- Linux Process Model — Tasks, fork, clone, copy-on-write, namespaces, and cgroups as the real Unix.
- fork() — Copy a process: the child gets 0, the parent gets a pid. Copy-on-write makes the copy cheap until a write.
- Working Set — The pages a process is actually using. If they do not fit in RAM, the system thrashes.