Skip to content

Try “polymorphism”, “TCP handshake” or “git rebase”.

    Operating Systems

    The manager inside every computer — processes, threads, scheduling, virtual memory, files and system calls.

    • Module 2 of 8
    • Beginner
    • 12 chapters
    • 1 h 18 min

    The operating system decides which program runs, how much memory it gets and what it may touch. Processes, threads, virtual memory and locks come up in every backend and concurrency interview.

    What you will be able to do

    • Tell a process from a thread, and say when each is used
    • Explain how a few cores are shared among hundreds of programs
    • Describe virtual memory, the stack and the heap
    • Spot race conditions and deadlocks, and explain how locks fix them
    • Explain blocking I/O, non-blocking I/O and event loops

    Chapters

    1. What an Operating System IsThe hotel manager plus staff is the operating system (OS): the software that manages the5 min2. User Mode, Kernel Mode and System CallsThe CPU itself enforces the locked doors. It has (at least) two modes:5 min3. ProcessesEach hotel guest gets their own room: their own bed, wardrobe, and belongings. Guests can't see into5 min4. Scheduling: Sharing a Few Cores Among Hundreds of ProgramsThe coach is the kernel's scheduler: it picks which ready process (or thread, Ch 7) runs on each5 min5. Virtual Memory: Every Process Gets Its Own Fake AddressesThe booklet numbers are virtual addresses. Every process sees its own private range starting near7 min6. The Stack and the HeapThe spike is the stack: memory for function calls. Each call pushes a stack frame holding6 min7. Threads: Several Workers Inside One ProcessA thread is one independent sequence of instructions inside a process — a "worker". Every process4 min8. Race Conditions and LocksA bug where the result depends on the exact timing of threads is a race condition.6 min9. Deadlocks: When the Fix Gets StuckAlways take locks in the same global order. If everyone takes A before B, the cycle can't form.3 min10. Files and File SystemsThe disk's numbered pages are blocks (commonly 4 KB).6 min11. Waiting for I/O: Blocking, Non-Blocking and Event LoopsI/O means input/output: any reading or writing to disk, network, keyboard, etc.4 min12. Signals and the Process Life CycleA zombie is a process that has exited but whose parent hasn't collected its exit code yet. It uses4 min

    Extras