Track 08 of 12 · Inside the runtime
How Programs Run
Follow source code into calls, memory, execution engines, types, and object design. The track replaces misleading either-or slogans with mechanisms that hold across modern compilers, interpreters, virtual machines, and runtimes.
Builds on:Programming & Data Representation
Ten concepts, in learning order
Each lesson assumes the ideas above it and prepares you for the ones below.
- 01Call stack and stack frameA call stack tracks active function calls in last-in, first-out order. A stack frame is the runtime state associated with one active call, which can include arguments, local storage, bookkeeping, and the point to resume in its caller, subject to optimization and runtime design.
- 02Stack vs heap memoryIn common runtime models, stack storage supports active calls with scoped, last-in-first-out allocation, while heap storage supports dynamically allocated objects whose lifetimes and allocation order need not follow call nesting. Exact placement and management are implementation- and language-dependent.
- 03Stack overflowA stack overflow occurs when execution requires more call-stack space than the runtime or operating environment permits. Deep or non-terminating recursion is a common cause, although unusually large stack allocations can also exhaust stack space in applicable languages.
- 04Compiler, interpreter, and JITA compiler translates a program representation into another representation before later execution; an interpreter directly performs the operations described by a representation; and a just-in-time (JIT) compiler translates code during execution, often using observed runtime behavior. Real implementations commonly combine all three techniques.
- 05Bytecode and virtual machineBytecode is an instruction representation designed for a software execution engine rather than a specific physical processor. A virtual machine (VM) defines and executes that abstract machine model, commonly by interpretation, native-code compilation, or both.
- 06Static vs dynamic typingStatic typing checks type constraints using program information before the relevant execution, while dynamic typing associates types with runtime values and checks applicable operations during execution. Languages can combine these approaches through inference, runtime checks, optional annotations, or gradual typing.
- 07Garbage collectionGarbage collection is runtime-managed reclamation of storage that a program can no longer use under the collector's model. Tracing collectors reclaim objects unreachable from roots; reference-counting systems can reclaim objects when counts reach zero and may use separate cycle detection. Algorithms, timing, and pause behavior vary by runtime.
- 08EncapsulationEncapsulation places a representation and the operations that maintain it behind a deliberately limited interface. Callers depend on supported behavior rather than manipulating internal state in ways that can violate invariants.
- 09Polymorphism and dispatchPolymorphism lets one expression or interface work with values of multiple types. Dispatch is the mechanism that selects an applicable implementation, which can occur dynamically from a runtime receiver type, statically through overloading, or through other language-defined forms.
- 10Composition vs inheritanceComposition builds behavior by holding and delegating to collaborating components, while inheritance defines a subtype relationship that acquires or overrides behavior from a parent type. The choice is about coupling and substitutability, not merely code reuse.
Continue the curriculum
Next: Data Structures & Complexity
Learn how data layout determines the cost of access, insertion, deletion, and traversal. Build a practical vocabulary for comparing structures by workload rather than by habit.
Open track 9