Subject: Re: Creeping Feature of the week...
To: Jason Thorpe <thorpej@nas.nasa.gov>
From: None <Chris_G_Demetriou@niagara.nectar.cs.cmu.edu>
List: current-users
Date: 01/31/1996 14:10:33
> On Wed, 31 Jan 96 13:23:18 EST 
>  Chris_G_Demetriou@NIAGARA.NECTAR.CS.CMU.EDU wrote:
> 
>  > I think you may have a different definition of 'cool' than I do...
> 
> Quite possibly, yes :-)
> 
>  > Even if you _wanted_ to do binary translation or binary emulation, you
>  > shouldn't to do it in the kernel, and there's no great _benefit_ to
>  > doing it in the kernel.
> 
> Over lunch yesterday, Stu and I were tossing ideas around that could 
> greatly improve the performance of his emulator.  We came up with at 
> least a couple of reasons why having a virtual machine run in the kernel 
> was a good idea (for some definition of good idea), one of which is 
> access to kernel facilities which just aren't available to user-space 
> (pick any number of such facilities...we were focusing on those 
> pertaining to I/O).

There's a big difference between creating a virtual machine, and being
able to run applications.  The question was about the latter.

The former is much, much harder, and isn't what you want to do to
emulate applications, anyway!

I assume that you're talking about a _real_ virtual machine, rather
than a virtualized OS-provided environment, because if you were
talking about the latter you'd likely not need special access to
kernel facilities...


For applications, you want to:
	(1) translate or interpret the basic instruction set so that
	    it's usable,
	(2) emulate the trap-causing, etc., instructions so that they
	    do the same things that they would under the original
	    system.  (i.e. translate syscalls into native syscalls, etc.)

That is, you want to be able to run the instruction set and provide
the facilities that the native OS did.

Emulating a full virtual machine means that you're emulating the
real hardware, and running the native OS, which is providing the
services done for (2) for applications.  That's monstrously slow, and
should be avoided if you can do so.  (For that, you might very well
want to live in the kernel...  but if you're trying to run
_applications_, you don't want to do that!)


Frankly, real virtual machines are boring these days:
	(1) they're slow,
	(2) you have to run the native operating system on
	    the virtual machine,
	(3) they've been done to death.

(3) is true to the point that random people creating 'virtual
machines' for hardware that has never even existed, just so they can
develop OSes for them...

Binary translation (or even interpretation w/o the basic virtual
machine) is much more interesting, and is what you'd want to use if
you were trying to implement a piece of code (in- or out-of-kernel)
that could run applications from another architecture.



cgd