Roadmap › How Computers Work — CPU, Memory, OS, Processes and Threads › Module: From Code to Execution
Lessons in this course (11)
10. Compilers, interpreters, JIT and AOT
IntermediateMediumLesson 10 of 11
| Model | How | Examples | Trade-off |
|---|---|---|---|
| Ahead-of-time compiled | Source → machine code before running | C, C++, Rust, Go, .NET Native AOT | Fast start, platform-specific binary |
| Interpreted | Interpreter executes source/bytecode line by line | Python (bytecode VM), classic JavaScript, PowerShell | Portable, slower |
| Bytecode + JIT | Compile to intermediate code; at runtime compile hot methods to machine code | .NET (IL → RyuJIT), Java (bytecode → HotSpot), JavaScript V8 | Portable + fast after warm-up, startup cost |
Compiler stages: lexing (characters → tokens) → parsing (tokens → syntax tree) → semantic analysis (types, symbols) → optimisation → code generation. The C# compiler Roslyn does these to produce IL; the JIT then turns IL into machine code for the actual CPU (x64 or ARM64), with tiered compilation (quick code first, optimised code for hot methods).