This article on AMD's upcoming CPU support for hardware virtualization has the best description of virtualization I've read to date:
In a modern-day virtualization system, a thin layer of software, called the virtual machine manager or hypervisor (both terms are common) runs on the processor. The VMM creates a number of virtual machines, into which it loads a standard, unmodified operating system, such as Linux, Solaris, or Windows.Each virtual machine thinks it's running on the bare metal, and has the computer entirely to itself. However, the VMM is constantly monitoring the execution of the virtual machines, interceding to redirect memory, storage and I/O requests to the specific allocated resources (think of paging, as an example), and emulating hardware interrupts that might let the software running within one virtual machine affect what's happening in another virtual machine, or even compromise the stability of the VMM itself. This software emulation includes, by the way, rewriting instructions, substituting instructions, changing calling parameters — there's a lot of stuff going on behind the scenes at the virtual machine manager level.
Evidently the x86 architecture is not well suited to virtualization because it doesn't meet something called the Popek and Goldeberg virtualization requirements. There are a number of problematic x86 instructions that require software interception and translation, eg, emulation:
All modern operating systems expect that their kernel and driver code is running in [Ring 0] privileged mode, which of course is fine in a non-virtualized PC. However, in a virtual machine, you don't want that kernel and driver code, or the interrupt handlers, to really have full control over the hardware; you need the VMM to be able to be able to transparently manage the system. But because both the VMM itself, and the virtualized guest operating system kernel and drivers are running in Ring 0— in other words, they're peers— the VMM has to do a lot of work to maintain control of the guest operating system. Thus, the emulation, and the performance hit that it represents.
How can we avoid this emulation penalty with hardware? Enter the dramatic, mysterious Ring Negative One:
That's where [hardware virtualization support] comes in. It comprises a set of instructions and architectural constructs that solve several of the thorniest problems in VMM software emulation of things like IO calls or interrupt handling. In effect, they create a superprivileged mode (sometimes referred to as "Ring -1"), which can only be used by the VMM. Because virtual machines and guest operating systems and applications continue to use traditional privileged and user modes, the VMM now has unique abilities to control the execution of virtual machine code running in Ring 0—without software emulation.
Intel is already shipping a number of CPUs that support hardware virtualization. Future versions may even allow you to hot-swap CPUs and memory:
Intel is working on a version of "Vanderpool" code named "Silvervale" for Xeon and Itanium server platforms. "Silvervale" differs from "Vanderpool" in terms of mission critical requirements such as hot-plug options as well as ability to change memory modules or even microprocessors on the fly, without shutting down the server.
AMD will follow suit with CPUs that have virtualization support later this year.
I firmly believe that, in the not too distant future, we'll always be running in a virtual machine. Hardware support for faster x86 virtualization is yet another important step in that direction.
Aside: I was going to title this post "Ring -1", but when I searched for that term in Google, I belatedly realized I was being stymied by something I just wrote about: dashes are treated as word seperators. As far as I can tell, it's impossible to search for the phrase "Ring -1" in Google.
Posted by Jeff Atwood View blog reactions
« Design Matters -- but Content is King A Setup Conundrum »
Take a look at Xen. It's interesting because it offers better performance than traditional virtualisation systems by modifying both host OS and guest OS. It's really interesting to learn about its optimisation techniques.
florisla on May 5, 2006 12:03 AMYes, I am familiar with that-- it's called paravirtualization:
http://en.wikipedia.org/wiki/Paravirtualization
It is interesting, but ultimately I think the hardware solutions have more promise because they're more general and require very little effort on anyone's part to get the best performance.
Plus, the odds of MS letting someone modify the Windows source is.. slim.. :P
Jeff Atwood on May 5, 2006 01:00 AMThe big question is, when will the virtualization vendors be able to virtualize the video card, rather than emulate a mid-1990s, very basic card. Once Vista/Aero Glass hit, working in virtual machines is going to be a lot less enticing until they figure out the video issue.
Kevin Dente on May 5, 2006 06:53 AMBut can you run a virtual machine inside a virtual machine under this new scheme? IIRC, IBM's supported this for decades.
Mike Swaim on May 5, 2006 07:04 AMCongratulations.
The PC will finally be able to do what the IBM System/390 (zSeries mainframe) has been doing for zillions of years.
VM/ESA, VM/CMS / MVS, etc.
Oh yeah, Tandem systems do this, too.
Christopher Sawyer on May 5, 2006 10:10 AMI've had good luck with Linux VServer -- multiple completely separate systems running on the same hardware, sharing the same kernel. Very low overhead. It's best for webhost-type situations, where you have lots of somewhat-similar things running, but each system should be separately "jailed" away from the others.
http://linux-vserver.org/short+presentation
shavenwarthog on May 5, 2006 10:15 AMGood thing you didn't call your post Ring -1, because the first result on Google when you search for "Ring -1" with quotes is an adult toy (http://www.amazon.com/gp/product/B000AS7EW4/102-6565027-6012124?v=glance&n=3760901)...
It's kind of infuriating when you're searching for good heuristics for the A* algorithm, because searching for "a-star" gets you all sorts of results with "...and a star was..."
Searching for "A*" gets you everything that starts with A.
*sigh*
pinano on May 5, 2006 10:26 AM> The PC will finally be able to do what the IBM System/390 (zSeries mainframe) has been doing for zillions of years.
I've told you a zillion times to stop exaggerating. But seriously, isn't this the entire history of the PC in a nutshell?
Jeff Atwood on May 6, 2006 12:17 AMUse the period operator in Google to search for ring-1, thusly:
ring..1 intel OR virtualization
Imprecise but it basically works.
Michael Seery on June 15, 2006 11:55 AM| Content (c) 2008 Jeff Atwood. Logo image used with permission of the author. (c) 1993 Steven C. McConnell. All Rights Reserved. |