emulator and virtual machine

4

I was wondering what differences and relations are between emulator and virtual machine? Is one a special kind of the other, and what are some other kinds in the other? I don't quite understand about these questions from the linked Wikipedia articles.

Tim

Posted 2011-06-02T01:31:43.940

Reputation: 12 647

Answers

3

As the terms are most commonly used, an emulator is any application that runs code designed for one platform on another platform.

A virtual machine is a special case of an emulator, in that it runs code designed for one platform in a virtualized environment on the same platform - for example, software like VMWare and VirtualBox run code designed for an x86 PC on an x86 PC - this makes it possible to run one operating system on top of another, among other things.

The difference between emulation and virtualization is that with emulation, the entire operating environment is simulated in software, whereas with virtualization, some portion of the work to be done is passed directly to the host CPU. Most modern x86 processors have hardware to accelerate this function. This makes virtualization very fast compared to emulators that have to take some action in response to each operation performed by the guest software.

One popular PC emulator is Bochs. Since it emulates the x86 hardware quite accurately (at the expense of speed), it can be very useful for OS-level debugging.

user55325

Posted 2011-06-02T01:31:43.940

Reputation: 4 693

Thanks! So by "platform", you mean the CPU architecture? – Tim – 2011-06-02T05:36:03.980

I mean the CPU architecture and any other specialized hardware the program might require - with x86 PCs you can use very generic hardware because programs are usually written to take advantage of higher-level APIs, which is one reason x86 virtualization is less complicated than, say, trying to run code written for one ARM platform on another - you can't virtualize your Nintendo DS on your cellphone even when the CPU architecture is largely the same, because you have to emulate all the graphics hardware, which is much more difficult. – user55325 – 2011-06-03T21:59:19.210

I also elided over the difference between a "virtual machine" (there are generic virtual machines like the JVM or the .NET runtime environment that are sort of like emulators, but they do a lot of just-in-time compilation into native code internally). – user55325 – 2011-06-03T22:02:17.840