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.
| Layer | What it does | Example |
|---|---|---|
| Hardware | CPU, RAM, disk/SSD, network card | Intel/AMD/ARM CPU, 16 GB RAM, NVMe SSD |
| Operating system | Manages hardware, memory, processes, files, network | Windows, Linux |
| Runtime | Runs your managed code, manages memory | .NET CLR, JVM, Node.js (V8) |
| Your program | Business logic | ASP.NET Core API, SQL Server, browser |
Versions & history
| Era | Milestone |
|---|---|
| 1945 | Von Neumann architecture — program and data stored in the same memory |
| 1971 | Intel 4004, first commercial microprocessor |
| 1978–1985 | x86 (8086) and 32-bit 80386 with protected/virtual memory |
| 1990s | CPU caches on chip, pipelining, superscalar execution; Windows NT, Linux |
| 2003–2005 | 64-bit x86 (AMD64); multi-core CPUs become standard |
| 2010s | SSDs replace HDDs; many cores; ARM in phones; cloud virtual machines |
| 2020s | Apple Silicon/ARM servers (AWS Graviton, Azure Cobalt), NVMe, GPUs/NPUs for AI |
Lifecycle
Life of a program run:
- Source code → compiler → machine code or intermediate code (IL for .NET).
- You start it → the OS creates a process: virtual address space, loads the executable and libraries, creates the main thread.
- The runtime (CLR) starts, JIT-compiles methods to machine code as they are first called.
- The CPU executes instructions: fetch → decode → execute → write back, millions per millisecond, using registers and caches.
- Data lives on the stack (method calls, locals) and the heap (objects); the OS maps virtual pages to physical RAM.
- I/O (disk, network) is requested from the OS; the thread waits or continues asynchronously.
- 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#).