Its true that an emulator and a virtual machine, from a certain point of view,
are basically the same thing. They are both software programs that provide an
execution environment for the instructions of a different program.
However, the two terms are used differently by
practitioners:
- An emulator is a software program which tries to
simulate, exactly, an existing execution environment (usually a hardware
platform). So for example, an "SNES emulator" simulates the hardware of an SNES
game console (its CPU, its sound chip, its memory addressing hardware, its
graphics chip, its DMA registers, and various other special-purpose
hardware).
- A virtual machine is a little different, in that the
instruction set it executes is usually designed for that virtual machine
(instead of being designed for a hardware chip). So the semantics of a Java
bytecode instruction might be much more complicated than what you would find in
a normal hardware instruction. The Java VM can execute bytecode instructions
like "invokevirtual" or "newarray", which might do the work of dozens or even
hundreds of typical hardware CPU instructions.
Another distinction
is that an "emulator" is concerned with emulating an entire execution
environment (usually a CPU plus several other hardware chips, for e.g. graphics
and sound). Any hardware that programs for the original environment relied on,
tends to be emulated in some way by the emulator. So if you have a PalmPilot
emulator for your PC, it will have some emulation of the touch screen hardware
(both output and input).
A "virtual machine" is usually only concerned with
the execution of instructions. It is a software implementation of a bizarre CPU
-- a CPU whose instructions are dictated by convenience (for the VM implementor
and for the programmers who write the programs that run on the VM) rather than
by hardware CPU design principles.
So, yeah. Although they overlap a lot
conceptually, the terms "emulator" and "VM" do have different meanings.
In a
past job, I did some work on a Java VM. And I have a hobby interest in the
emulation of old game consoles, so that's how I know these things.
:P
Groklaw. When you want to know more, but don't know where to
look. [ Reply to This | Parent | # ]
|
|