bigonotes
CS ConceptsOS Fundamentals

OS Fundamentals

Processes, threads, locks, scheduling and memory — the OS basics.

16 notes · 81 min total

  1. 1Processes vs ThreadsAudioHow a process lays out memory, how it moves through its lifecycle, and what threads share versus keep private.11 min
  2. 2Context SwitchingAudioWhat the OS saves and restores when it swaps tasks, and why a process switch costs far more than a thread switch.5 min
  3. 3CPU SchedulingAudioHow the OS decides which ready task runs next: FCFS, SJF, round robin, priority scheduling and multi-level feedback queues.8 min
  4. 4Virtual MemoryAudioHow pages, page tables, the TLB and page faults give every process its own private, contiguous address space.5 min
  5. 5Race Conditions and MutexesAudioWhy unsynchronized read-modify-write corrupts shared data, and how a mutex makes a critical section run one thread at a time.3 min
  6. 6Atomic OperationsAudioHow hardware instructions like compare-and-swap update one value without a lock, and when you still need a mutex.4 min
  7. 7SpinlocksAudioWhy a spinlock busy-waits instead of sleeping, when that beats a mutex, and why it only pays off on multi-core machines.6 min
  8. 8SemaphoresAudioHow a semaphore's counter limits concurrency to N threads, enables signaling, and differs from a mutex because it has no owner.5 min
  9. 9Producer-Consumer ProblemAudioHow two semaphores and a mutex coordinate a bounded buffer, and why the order you acquire them in prevents deadlock.4 min
  10. 10DeadlocksAudioThe four conditions that cause a deadlock, and how breaking each one (especially lock ordering) prevents it.5 min
  11. 11Starvation vs Deadlock vs LivelockAudioHow to tell the three liveness failures apart by symptoms, causes and fixes.3 min
  12. 12sleep() vs wait()Why sleep() keeps your locks while wait() releases them, and where yield() fits in.3 min
  13. 13Thread PoolsWhy servers reuse a fixed set of worker threads fed by a queue, and how to size the pool for CPU-bound and I/O-bound work.5 min
  14. 14Async vs MultithreadingAudioHow an event loop and multiple threads each avoid wasted waiting, and which to choose for I/O-bound vs CPU-bound work.5 min
  15. 15Python GILWhat CPython's Global Interpreter Lock is, why it exists, why threads don't speed up CPU-bound Python, and how to work around it.5 min
  16. 16Concurrency Cheat SheetA one-page review of race conditions, locks, atomics, semaphores, deadlock, scheduling and async, with links to each lesson.4 min