Runtime Systems and Virtual Machines
Runtime systems and virtual machines provide the execution environment for programs, interpreting or compiling intermediate code and managing the services a running program needs.
Definition
A runtime system is the software environment that supports a program's execution beyond its own code, and a virtual machine is an abstract execution engine that interprets or compiles a portable instruction set, providing portability and runtime services.
Scope
This topic covers the layer between compiled code and hardware: bytecode interpreters and abstract machines, just-in-time (JIT) compilation, dynamic dispatch and method lookup, calling conventions and stack management, and runtime services such as exception handling and reflection. It addresses the design of portable virtual machines and the techniques that make managed languages efficient.
Core questions
- How do virtual machines provide portability across hardware?
- How does just-in-time compilation combine interpretation and native code?
- How are dynamic dispatch and method lookup made efficient?
- What runtime services must support a managed language?
Key theories
- Portable virtual machine architecture
- The Java Virtual Machine specification defines a portable, verifiable bytecode and execution model, demonstrating how a virtual machine decouples a language from particular hardware.
- Just-in-time compilation
- Aycock surveys the techniques by which runtimes compile code to native form during execution, balancing interpretation startup against the throughput of compiled code using runtime information.
- Inline caching for dynamic dispatch
- Deutsch and Schiffman's Smalltalk implementation introduced inline caching and dynamic translation, key techniques for making method lookup in dynamically dispatched languages fast.
Clinical relevance
Virtual machines and managed runtimes power widely used platforms for Java, .NET, JavaScript, and Python, providing portability, safety, and adaptive optimization. JIT compilation and inline caching are why high-level, dynamic languages can achieve competitive performance.
History
Abstract machines date to early portable systems and Smalltalk, whose 1984 implementation pioneered dynamic translation and inline caches. The Java Virtual Machine popularized portable bytecode in the mid-1990s, and adaptive JIT compilers such as HotSpot and later JavaScript engines brought aggressive runtime optimization to mainstream managed languages.
Debates
- Interpretation versus just-in-time compilation
- Runtime designers weigh simple interpreters with fast startup and low memory use against JIT compilers that achieve higher peak performance at the cost of warmup time and implementation complexity, often combining the two in tiered systems.
Key figures
- Peter Deutsch
- John Aycock
- James Gosling
- Gilad Bracha
Related topics
Seminal works
- lindholm2014
- aycock2003
- deutsch1984
Frequently asked questions
- What is a virtual machine in this context?
- Here a virtual machine is a software execution engine that runs a portable instruction set (such as bytecode), abstracting over the underlying hardware and providing runtime services rather than emulating a whole computer.
- How does just-in-time compilation help performance?
- A JIT compiler translates frequently executed parts of a program to native code at runtime, using profiling information that an ahead-of-time compiler lacks, so hot code runs at near-native speed.