Now that we understand how
hardware-supported protection levels can be used, we can start explaining how
virtualization techniques can be developed that achieved our goal to
efficiently at near native speeds allow execution of virtual machines on top of these basically
identical virtual platforms. First, guest instructions are executed
directly by the hardware. That’s important thing to know. The virtual machine
monitor does not interfere with every single instruction that is
issued by the guest operating system, or its applications for that matter. What this means is that just like the OS
doesn’t interfere on every single instruction and memory access, here the
hypervisor does not interpose itself on every single operation and every single
memory access performed by the guest. As long as the guest
operating system and its applications operate within
the resources that were allocated to them by the hypervisor,
then everything is safe. The instructions in those cases
will operate at hardware speeds and this will lead to efficiency of
the virtualization solution. Whenever a privileged instruction gets
accessed, then the processor causes a trap, and control is automatically
switched to the most privileged level, so to the hypervisor. At this point the hypervisor can
determine whether the operation is to be an allowed or not. If the operation is an illegal
operation and it shouldn’t be allowed, then the hypervisor can perform some
action like to terminate the VM. If the operation is, should be allowed,
however, it’s a legal operation, in that case, the hypervisor should
perform the necessary emulation so that the guest operating system is
under the impression that it actually does have control over the hardware. So from the guest perspective, it should
seem as if the hardware did exactly what it was expected to do
given the instruction. In reality, however, it was the hypervisor that intervened,
that potentially executed slightly different set of operations
in order to achieve that emulation. This trap-and-emulate mechanism is
a key method in which virtualization solutions rely in order to achieve
efficient CPU virtualization.

Processor Virtualization
Tagged on:         

Leave a Reply

Your email address will not be published. Required fields are marked *