Compute & Memory Foundations¶
Tier: 0 (Computational Foundations)
Concepts: 14
Durability: Timeless (rooted in physical constraints of silicon, speed of light, and mathematical limits of numeric representation)
Fundamental Tensions¶
| Tension | Description |
|---|---|
| Speed vs. Capacity | Faster memory requires physical proximity to the processor and simpler circuitry, inherently limiting capacity. This creates the memory hierarchy - a fundamental trade-off that cannot be eliminated without violating physics (speed of light, signal propagation). |
| Locality vs. Abstraction | High-level abstractions (objects, closures, indirection) improve programmer productivity but scatter related data in memory, harming locality. Clean code and cache-friendly code often pull in opposite directions. |
| Precision vs. Performance | Exact arithmetic requires arbitrary precision and is computationally expensive. Fixed-size floating point enables hardware acceleration but introduces representation errors. This is a mathematical necessity - infinite real numbers cannot fit in finite bits. |
| Predictability vs. Flexibility | Processors optimize for predictable patterns (sequential access, consistent branches). Flexible, data-dependent code paths defeat these optimizations. Hardware speculation requires regularity to be effective. |
| Isolation vs. Efficiency | Virtual memory provides process isolation and address space abstraction, but adds indirection cost. Direct physical access would be faster but unsafe. Security and performance trade off at the memory management layer. |
Concepts¶
- Memory Hierarchy
- Locality Principles (Temporal and Spatial)
- Cache-Conscious Design
- Latency Numbers Intuition
- CPU-Bound vs. I/O-Bound Distinction
- Branch Prediction and Speculative Execution
- Instruction Pipelining
- SIMD and Data Parallelism
- Floating-Point Representation Limits
- Floating-Point Arithmetic Pitfalls
- Integer Overflow and Representation
- Virtual Memory Abstraction
- Page-Based Memory Management
- Memory-Mapped I/O
Cross-Domain Transfer Summary¶
| This Domain Concept | Transfers To |
|---|---|
| Memory Hierarchy | Database buffer pools, CDN architecture, distributed caching, storage tiering |
| Locality Principles | Query optimization, garbage collection, JIT compilation, recommendation systems |
| Cache-Conscious Design | Column stores, entity-component systems, scientific computing |
| Latency Numbers Intuition | Distributed systems, API design, capacity planning |
| CPU-bound vs I/O-bound | System design, scaling strategies, language selection |
| Branch Prediction | Query execution, virtual machines, compiler optimization |
| Instruction Pipelining | Stream processing, CI/CD design, assembly line optimization |
| SIMD/Data Parallelism | Machine learning, GPU computing, data processing |
| Floating-Point Limits | Financial systems, scientific computing, ML training |
| Floating-Point Pitfalls | Numerical algorithms, physics simulations |
| Integer Overflow | Security, embedded systems, financial calculations |
| Virtual Memory | Containerization, database design, runtime memory models |
| Page-Based Management | File systems, allocators, virtualization |
| Memory-Mapped I/O | Database buffer pools, IPC, high-performance I/O |
Canonical Sources¶
| Source | Coverage |
|---|---|
| Patterson & Hennessy, Computer Organization and Design (1994+) | Memory hierarchy, CPU architecture, pipelining, I/O |
| Hennessy & Patterson, Computer Architecture: A Quantitative Approach | Advanced CPU concepts, performance analysis |
| Drepper, "What Every Programmer Should Know About Memory" (2007) | Memory hierarchy, caching, NUMA, practical optimization |
| Goldberg, "What Every Computer Scientist Should Know About Floating-Point Arithmetic" (1991) | Floating-point representation, precision, arithmetic pitfalls |
| Denning, "The Working Set Model for Program Behavior" (1968) | Locality, virtual memory theory, working sets |
| Silberschatz et al., Operating System Concepts | Virtual memory, process management, memory protection |
| Dean & Barroso, "The Tail at Scale" (2013) | Latency at scale, percentiles, system design |
| Flynn, "Very high-speed computing systems" (1966) | SIMD classification, parallel architectures |
| Higham, Accuracy and Stability of Numerical Algorithms | Numerical analysis, floating-point stability |
| Fog, Optimizing software in C++ and microarchitecture manuals | Practical CPU optimization, pipeline details |