Session 2 of Software Lessons, “Computer Processing 101: How Code Executes,” runs about 30 minutes.
What this session covers
- CPU cores and caches
- Parallel processing and threads
- Deterministic versus stochastic systems
- Compiled versus interpreted languages
- JIT compilers and performance
Key ideas
- A CPU core executes one instruction stream at a time, and caches keep recently used data close to the core because main memory is much slower.
- A thread is a sequence of instructions the operating system can schedule, and several threads can run at once on several cores.
- A deterministic system gives the same output for the same input every time, while a stochastic system involves randomness.
- A compiler translates a whole program into machine code ahead of time, while an interpreter reads and executes the program as it runs.
- A just-in-time (JIT) compiler translates code to machine code while the program runs, which can combine the flexibility of interpretation with faster execution.