An alternative open source virtualization solution: VirtualBox
To accelerate the product development and test, we usual choose some kinds  of virtualizer to  simulate environment, such as VMware workstation, Virtual  PC etc. With these kinds of VM, we can build the environment one time, and  reuse it again and again, just take snapshot and rollback it.     But if we have some advance requirement, such as control the VM to  implement some auto-test script, these commercial products maybe restrict your  idea. Even they provided some SDK, the ability is very limited.    Fortunately we have some alternative virtualization solutions, such as VirtualBox. It is a  general-purpose full virtualizer for x86  hardware. Targeted at server, desktop and embedded use, it is now the only  professional-quality virtualization solution that is also Open Source  Software.    The usage and GUI  of VirtualBox is very like VMware, so we can switch to it easy. The VirtualBox  can be downloaded and  installed on Windows, Linux and OS X hosts; And the guest OS can support mostly  common platform, such as Windows, Linux, xxxBSD, etc. A complete guest OS  list can be found at Guest  OSes. It also has an open  source edition under the GPL license, but it isn't including some advance  features, such as RDP support.    Compare with VMware or other VM vender, VirtualBox has a great openness.  It's virtual machine descriptions in XML, we can easy fetch information from it;  It's VM directly support RDP (Remote Desktop  Protocol) protocol, so we can use remote  desktop connection software to control it, the latest version of VMware -  Workstation 6.0 provide similar feature which allow remotely access the console  of a VM from a VNC client.    Furthermore, the most important difference is VirtualBox provided a very  powerful management interface. For end-users, they can use VBoxManage in command  line to control most common functions of VM; for developers, they can get some  depth control with a set of COM/XPCOM  control interfaces, such as control the keyboard/mouse action etc.    From the implementation viewpoint, the architecture of VirtualBox much  likes a client/server solution. The controller client, such as QT-based GUI or  console mode VBoxManage, connects to the backend VM implementation (VBoxVMM,  etc.), through COM/XPCOM interface (VBoxSVC, VBoxC, etc).    In addition, a kernel driver (VBoxDrv.sys on Windows) or module (vboxdrv  on Linux) will allocating physical memory for the VM, control the context switch  and other dirty work.   But not like Xen and VMware,  VirtualBox is not directly depending on some kinds of hardware virtualization  technology, such as VT or AMD-V.  VirtualBox run the guest OS kernel at ring 1, through some advanced code  scanning, analysis and patching techniques, such as "Patch Manager" (PATM) and  "Code Scanning and Analysis Manager" (CSAM).  Before executing ring 0 code, we scan it recursively to discover  problematic instructions. We then perform in-situ patching, i.e. we replace the  instruction with a jump to hypervisor memory where an integrated code generator  has placed a more suitable implementation. In reality, this is a very complex  task as there are lots of odd situations to be discovered and handled correctly.  So, with its current complexity, one could argue that PATM is an advanced  in-situ recompiler.  In addition, every time a fault occurs, we analyze the fault's cause to  determine if it is possible to patch the offending code to prevent it from  causing more expensive faults in the future. This turns out to work very well,  and we can reduce the faults caused by our virtualization to a rate that  performs much better than a typical recompiler, or even VT-x technology, for  that matter.     This method seems specially but  effective, at least on my machine, VirtualBox run some OS correctly and very  fast.     If you have more detail question, please refer to their Developer FAQ or  directly read the source code.  :) 
 
No comments:
Post a Comment