Brian said:
I would say it is emulated, but almost entirely in hardware that runs at
full speed.
Any instructions that are restricted inside the VM, are trapped and handled
by whatever is considered appropriate for emulation. If a privileged instruction
was attempted, you'd want to trap that for safety reasons.
VirtualPC runs native, in the sense that most normal user mode code runs
natively (instruction just executes with no fuss). In a benchmark, I was
getting around 90% of the same speed as I'd get running a program directly
in Windows. I ran the SuperPI benchmark inside VPC2007. The benchmark is
single threaded (to match the uniprocessor emulation inside VPC2007),
and it ran at about 90% of native Windows speed.
This is in sharp contrast to the way virtual machines used to run on other
platforms. For example, I have the (paid-for) version of VirtualPC for Macintosh,
where an x86 instruction is replaced with an equivalent sequence of PowerPC
instructions, and you're lucky if that runs at 10% of the regular speed.
The slowest I've ever used, was probably SoftWindows running on a Sparc workstation,
where the workstation was already hobbled by running at 400MHz, and then the virtual
machine ran at about 10% of that. (That converts x86 code to Sun Sparc code.) The
first virtual machines did a lot of trapping of things, which made them like slide
shows. Some kinds of operations on the frame buffer, were pitifully slow. You could
watch the pixels being updated, row by row.
By comparison, the modern VMs, at least the ones running x86 on x86 (i.e. same arch),
run at almost full speed.
In my testing, I also found that the so-called "hardware virtualization support"
VT-X, made no difference at all to user level performance. So whatever instructions
that convert from traps to native, seem to make no difference to the user
experience. The only time that kind of setting makes a difference, is when it
makes a Linux VM crash :-( That's the only reason for changing the preference on
a virtual machine setup, is to stop crashing.
Paul