Take the 2-minute tour ×

Vmware is a user installed software. So it should run in user space given by the underlying OS. Yet its runs OS-es which are fully operational and need to run in kernel mode. So where does it run?

share|improve this question

migrated from stackoverflow.com Jun 20 '10 at 22:32

This question came from our site for professional and enthusiast programmers.

4 Answers 4

VMWare provides a whole bunch of projects and Vinko Vrsalovic already pointed out that VMWare ESX is indeed an own operating system.

Generally, it is possible to run virtual machine monitors (VMM) such as VMWare Workstation, QEmu, or Virtualbox completely in user space. They just take a disk or CDROM image of the OS to run and start emulating a PC by interpreting all instructions and emulating device accesses. For performance reasons, virtualization software however tries to avoid emulation as often as possible, because it is much faster to execute an instruction stream on the real hardware instead of emulating it.

Several approaches are used to speed up virtualization process:

  • Binary rewriting: Your virtualized OS executes an OS kernel and user space applications. For user-space apps, the same restrictions in terms of instruction execution apply as do to your virtual machine monitor itself, so it is no problem to execute these applications on the native CPU. For the OS part, you however need to emulate the behavior of the underlying CPU as your VMM is not able to do so itself. What you now need is to detect all switches between user code and kernel code, so you can efficiently switch between native execution and emulation. VMWare as well as Qemu apply binary rewriting to the virtualized OS as it is executed and thereby trap all those switches.

  • Hardware-assistance: With the rising popularity of VMMs (which have been around since the 1970s), Intel and AMD started providing hardware extensions to their instruction sets which ease implementation of a VMM in user space.

  • Kernel extensions: VMWare as well as Qemu also enable you to install a device driver in your host operating system that enables them to speed up execution of kernel code and device accesses by directly executing in kernel mode.

  • Pass-through device drivers: Device I/O is another performance issue. Normally, a VMM will implement a set of virtual devices that behave similar to their real-world counterparts. This emulation step slows down I/O and is a major performance bottleneck when virtualizing an OS. To avoid that, VMMs also allow you to install a bunch of device drivers in the virtualized guest OS that are aware of the guest hardware and allow to directly pass through a device from the host OS to the guest without the emulation step. (This however only works if you run exactly one OS instance on your host, because no one else will be able to access the device if you pass it to the guest).

share|improve this answer
Very nice summary. Binary rewriting, of course, is VMWare's original strategy. –  Andres Jaan Tack Jun 20 '10 at 12:29

It just depends on what type of VMWare program you run. Some run in the kernel, some run in user space.

share|improve this answer

VMware works, as a downloadable version, as a user-level program. It uses a virtual machine monitor to intercept real x86 instructions, and a device driver to execute concurrent execution of a guest OS with CPU virtualization implementation to get hardware-assisted virtualization in order to run guests through its VMM while still being on top of an OS and being a process or so. The same exact thing is with Virtualbox -- they are programs that normally do not run on bare metal (but could) and they themselves use a VMM and CPU VT from Intel and such to intercept x86 and "trick" the guest OS into thinking it's running the whole machine, and emulates support hardware that's usually not truly existing. In a way it's like emulating and not emulating mixed together. For example, it probably emulates BIOS/firmware since there's no virtualization methods for that. It probably also emulates older, legacy hardware that virtualized guest Windows 95/98 may need.

In simplicity, it's using CPU features that aid in virtualization processing to enable another OS to run on the same CPU through a complex monitoring/substituting emulation process while not having to truly be a bare metal OS.

share|improve this answer

Discounting the fact that software like VMWare ESX is an OS by itself (a modified Linux version), the on top of another OS version usually run in both kernel space and user space, it installs drivers (which run in kernel space) for all the privileged tasks (networking, monitoring and so forth.)

share|improve this answer

Your Answer

