permacomputing

Source repository for the main permacomputing wiki site
git clone http://git.permacomputing.net/repos/permacomputing.git # read-only access
Log | Files | Refs

virtual_machine.mdwn (2601B)


      1 # Virtual machine
      2 
      3 A **virtual machine** is an implementation of a computer on top of another.
      4 An **emulator** is specifically a virtual machine that simulates a different
      5 type of computer that also exists as real hardware. If the "emulated"
      6 computer is similar to the one that runs the emulator, the commonly used
      7 term is **virtualization**. Virtual machines that have no real-hardware
      8 counterpart (such as the Java Virtual Machine) are usually just called VMs,
      9 but their machine languages are usually referred to as **bytecode** rather
     10 than machine code.
     11 
     12 Virtual machines can be used to ensure compatibility of a software – both
     13 across different types of hardware and in constantly changing software
     14 environments (i.e. to avoid [[software rot]]). Very simple virtual machines
     15 (ones that may be very slow but can be implemented in a very short time) are
     16 sometimes suggested as a means for very-long-term software preservation.
     17 
     18 Virtual machines designed to run applications usually have the same kind of
     19 [[dependency]] and obsolescence problems as modern computer platforms in
     20 general. So, instead of ensuring compatibility, things like the Java Virtual
     21 Machine are more likely to add just another unreliable layer of
     22 dependencies. In order to avoid this, the design of the VM should be frozen
     23 and discourage software dependencies.
     24 
     25 A general problem with virtual machines is the virtualization overhead,
     26 especially if the instruction set differs from that of the host computer. An
     27 emulated program may require several times the computing resources of an
     28 equivalent native program. JIT translation can be used to reduce this
     29 overhead. [[Static binary translation]] could be used to remove (nearly) all
     30 of the overhead, but is far more difficult to implement automatically.
     31 
     32 **Fantasy platforms** are a class of virtual machines designed to be
     33 superficially similar to classic home computers, including immediate and
     34 worriless programmability with a simple programming language. A common
     35 design mistake in otherwise constrained fantasy platforms (such as
     36 [[TIC-80]]) is **uncapped speed** that allows the host computer to run the
     37 programs as fast as it can. This encourages programs that "push the limits"
     38 of the VM while actually taking advantage of the speed of the host computer
     39 and wasting a lot more energy for doing the same thing.
     40 
     41 Virtual machines:
     42 
     43   * [[Uxn]]
     44   * [[p-code]]
     45   * [[Chip8]]
     46   * [[TIC-80]]
     47   * [[WebAssembly]]
     48 
     49 Languages that are usually compiled into virtual machine bytecode instead of
     50 native code:
     51 
     52   * [[Forth]]
     53   * [[Java]]
     54   * Most scripting languages ([[Lua]], etc.)