Roadmap › 0. Fundamentals › Step 1
CPU

How Computers Work — CPU, Memory, OS, Processes and Threads

What happens inside a computer when your program runs — bits and bytes, the CPU and instruction cycle, the memory hierarchy (registers, cache, RAM, disk), stack vs heap, virtual memory and paging, the operating system, processes and threads, scheduling, concurrency problems, compilation vs interpretation, and how all of it shows up in .NET and SQL Server.
What it is & where it is used

Every program you write — a C# API, a SQL query, a React page — finally runs as instructions on a CPU reading and writing memory, managed by an operating system. Knowing this layer explains things that otherwise look like magic: why a cache makes things fast, why the heap needs a garbage collector, why threads cause race conditions, why a query that reads from disk is slow.

LayerWhat it doesExample
HardwareCPU, RAM, disk/SSD, network cardIntel/AMD/ARM CPU, 16 GB RAM, NVMe SSD
Operating systemManages hardware, memory, processes, files, networkWindows, Linux
RuntimeRuns your managed code, manages memory.NET CLR, JVM, Node.js (V8)
Your programBusiness logicASP.NET Core API, SQL Server, browser
Versions & history
EraMilestone
1945Von Neumann architecture — program and data stored in the same memory
1971Intel 4004, first commercial microprocessor
1978–1985x86 (8086) and 32-bit 80386 with protected/virtual memory
1990sCPU caches on chip, pipelining, superscalar execution; Windows NT, Linux
2003–200564-bit x86 (AMD64); multi-core CPUs become standard
2010sSSDs replace HDDs; many cores; ARM in phones; cloud virtual machines
2020sApple Silicon/ARM servers (AWS Graviton, Azure Cobalt), NVMe, GPUs/NPUs for AI
Lifecycle

Life of a program run:

  1. Source code → compiler → machine code or intermediate code (IL for .NET).
  2. You start it → the OS creates a process: virtual address space, loads the executable and libraries, creates the main thread.
  3. The runtime (CLR) starts, JIT-compiles methods to machine code as they are first called.
  4. The CPU executes instructions: fetch → decode → execute → write back, millions per millisecond, using registers and caches.
  5. Data lives on the stack (method calls, locals) and the heap (objects); the OS maps virtual pages to physical RAM.
  6. I/O (disk, network) is requested from the OS; the thread waits or continues asynchronously.
  7. On exit the OS frees all memory, handles and threads of the process.
Tools used to develop
  • Windows: Task Manager, Resource Monitor, Performance Monitor (PerfMon), Process Explorer, Windows Performance Analyzer.
  • Linux: top/htop, ps, free -h, vmstat, iostat, lsof, perf.
  • .NET: dotnet-counters, dotnet-trace, dotnet-dump, Visual Studio Diagnostic Tools, PerfView, BenchmarkDotNet.
  • Learning: godbolt.org (see machine code), SharpLab.io (see IL and JIT assembly for C#).