Virtual Machines differ from platforms in that a virtual machine may form the core of a platform. Virtual machines typically provide an environment for executing code (either a bytecode set unique to the VM or, in rare cases, compiled machine code) and often provide a set of services to that executing code, such as code-loading, execution access control and security, garbage collection, metadata access, and so on.

VM Implementation

Crafting Interpreters

Bytecode

See http://www.complang.tuwien.ac.at/forth/threaded-code.html for an introduction to threading techniques, including a performance comparison at http://www.complang.tuwien.ac.at/forth/threading/

Stack-based vs Register-based

This is often abstract variations of the register-vs-stack debate that CPUs engage in; generally a VM will either be entirely stack-based (using a virtual stack that may or may not correspond to the real stack), or entirely register-based (though often a stack is still present in a register VM, for other purposes).

Garbage collection

Much of this is going to be found in the reading on memory management. VMs typically offer some form of automatic memory management, since they can slightly intervene around raw pointer references and add either additional bookkeeping or indirection or "pointer fixups" to allow for objects to move around in memory w/o programmer awareness/knowledge.

Tutorials

Creating a VM/Compiler

Virtual machine in C ("felix.engineer"): six-register and stack

Terrence Parr: Simple Virtual Machine: Video and slides

Basic cpu: a register-based virtual machine in c | How to build a virtual machine from scratch | Create your own stack machine | Build your own virtual machine - Lexer | Build your own virtual machine - assembler | Build your own virtual machine - Finish the assembler | Build your own virtual machine - Finish up --all by Philip Bohun who has some additional videos

Simple Object Machine: A minimal Smalltalk for teaching of and research on Virtual Machines. Implementations:

Sites

Awesome Open Source: Top 137 Virtual Machine Open Source Projects

GitHub search for "virtual machine":


Detail Pages:

Last modified 20 December 2022