Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am researching a bit on virtualization for my class presentation.

I am not clear about the terms - "virtualizable instructions" and "non-virtualizable instructions".

Could someone here please explain that ?

share|improve this question
add comment

2 Answers

This is really a CPU architecture/instruction mechanics question -- See http://swtch.com/~rsc/talks/pcarch.pdf for some good material for your research, including details on why certain instructions aren't "virtualizable" (unless you're going to emulate the WHOLE CPU like Bochs does (uberslow)).

share|improve this answer
1  
Or trap it, like VMware does. Or run under the whole OS on a completely different level, like KVM does. –  Ignacio Vazquez-Abrams Apr 6 '10 at 16:05
    
Thanks for the pdf. –  Hrishikesh Choudhari Apr 6 '10 at 16:06
add comment

in short:

  • most processors have different privilege levels; that lets the OS interrupt, confine and kill processes without letting any user-level process affect any other.
  • there are instructions to handle the privilege level, some low level hardware managing. usually these instructions are restricted to work only at the most privileged level, therefore the OS have to run at this level
  • if you try to run low-level OS code in a lower privilege, those low-level instructions will fail. ideally, the failure should trigger some 'real lower level' OS, that could make whatever magic is needed to create the illusion that the failed code is running on bare metal machine.
  • unfortunately, on x86 a few instructions either fail silently or trigger global failure, so they're referred as 'non virtualizable'.

that's the problem. Now the solutions:

  • paravirtualization: patch the OS, so it doesn't use the problematic instructions. instead it uses calls to the underlying system. (this is used in Xen PV guests, only feasible with open OSes)
  • emulation: run the code in an emulated CPU, with code that interprets each instruction. (used by BOCHS and a few other emulators)
  • recompilation: instead of interpreting each instruction, generate new machine code that does the same thing as the original code; but with the desired trapping. (used by QEMU)
  • automatic patching: scan the code, if there's any 'problem' instruction, replace it in place with a call to the underlying system. (used by KQEMU and VMWare)
  • 'hardware virtualization': both Intel and AMD recently added an extra mode that adds the required traps to those nonvirtualizable instructions. (used by Xen HVM, KVM, VirtualBox)
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.