Abstract Machine Models Also: what Rust got particularly right
11 days ago
- #abstract-machine-models
- #hardware-architecture
- #programming-languages
- The author studied the relationship between programming languages, hardware architectures, and programmers from 2010 onwards.
- A research project from 2008-2012 involved designing programming tools for a new microprocessor architecture, revealing the disconnect between hardware design and software tooling.
- Programming languages are deeply linked to hardware architectures, affecting algorithm efficiency and toolchain design.
- The distinction between descriptive models (for analysis) and specification models (for design) is crucial in computing epistemology.
- Haskell's denotational semantics initially obscured the difference between description and specification for the author.
- Three functionally equivalent Haskell sort implementations (bead sort, quicksort, insertion sort) highlighted the limitations of denotational semantics in capturing runtime performance differences.
- Automatic derivation of all functionally equivalent programs from a given specification is undecidable, debunking the idea of universally general optimizing compilers.
- Programmers use Abstract Machine Models (AMMs) to predict runtime behavior, which exist independently of programming languages and hardware platforms.
- AMMs extend functional models with extra-functional behaviors like time, memory usage, I/O, and concurrency semantics.
- Programming skills are better understood in terms of AMMs rather than specific languages or hardware.
- Different AMMs exist (e.g., C/C++, Unix, JVM, JS/DOM, BEAM, GPUs, GHC/MIO, Go, SQL), each with unique operational semantics.
- Language designers fall into three categories: machine-first, second-language, and AMM-first designers.
- Rust's design combines the C/C++ AMM with functional ergonomics and safety guarantees, pushing the Pareto envelope of control vs. guarantees.
- Parallel programming remains challenging due to the lack of effective AMMs for heterogeneous hardware.
- AMMs are not on a linear spectrum of control vs. guarantees; some offer more control without sacrificing guarantees (e.g., Rust).
- The author integrates AMMs into teaching and mentoring, improving cross-language and cross-platform reasoning.