[comp.sys.intel] Virtual Machines

wayne@dsndata.uucp (Wayne Schlitt) (09/17/90)

In article <1407@svin02.info.win.tue.nl> wsinpdb@svin02.info.win.tue.nl (Paul de Bra) writes:
> In article <7680003@hp-lsd.COS.HP.COM> paulc@hp-lsd.COS.HP.COM (Paul Carroll) writes:
> >> Is it outrageous to assume that Intel may build the 80586
> >> to run in the virtual 80386 mode?
> ...
> What we need is a chip, say 80n86, which has a virtual 80n86 mode.
> This would mean that if the system is running operating system A,
> you can have a virtual operating system B running on it, or vice versa,
> and both will see a real 80n86 processor.
> 

for a long time, whenever anyone said "VM", i thought of virtual
machines, not virtual memory.  _every_ operating system had virtual
memory, right?  :->

yes, there are computers that can run virtual copies of themselves.  in
particular, the large ibm mainframes can.  there is even a popular
operating system for it called VM/CMS.  (the VM stands for Virtual
Machine.)  it was is my favorite mainframe operating system.  VM/CMS
would allow you to create a virtual machine and boot up another copy
of VM/CMS, which you could again create a virtual machine running
under this second copy, etc...  i have done it many times.

there is one _tiny_ drawback to this type of system.  it is
_extremely_ expensive.  to create a computer with a virtual 386 mode
would be even more expensive.

the major problems are:

1) since the Virtual Machine just sees low level hardware, the
   communication between the Virtual Machine and it's parent operating
   system is no where near as efficient as it is between a regular
   process and an operating system.  

2) you have a second level of BS between the application program and
   the real hardware.  every program running under this Virtual
   Machine must make request to the operating system running on the
   virtual machine, and then that operating system tries to do things
   that can only really be done by the master operating system.  

   just doing a divide by zero cause the master operating system to be
   interrupted and it has to execute a lot of code to send an interrupt
   to the virtual machine which has to execute a lot of code to send
   the program the interrupt.  it takes twice as long to do any system
   level task.

3) simulating virtual memory on top of virtual memory is real
   expensive.  the computer only has one real set of page tables, and
   every time the virtual machine tries to change one of it's page
   tables, the master operating system has to somehow verify that the
   modification is ok, and then do something with the real page
   tables.  simulating page faults and such is real expensive.
   unfortunately, manipulating page tables happen a lot.

3) i/o is difficult and slow.  every i/o that the virtual machine does
   has to be trapped, checked to make sure it isnt doing something it
   shouldnt be doing and then simulated on top of the real hardware.
   on the ibm mainframes, all the i/o is done via a limited set of
   instructions and command words.  on the 386, a great deal of it is
   done via memory mapped i/o.  this means that there are a lot more
   possible ways of doing i/o and a lot more things to keep track of.


ibm has had to add a whole bunch of real hardware to assist in this
virtual machine stuff.  this isnt simple hardware either.  since ibm
isnt trying to squeeze everything onto one chip, this extra hardware
doesnt cost as much as it would on a 80586.  this extra hardware is
also completely wasted if you arent running virtual machines.  and
virtual machines that use virtual memory or have complex operating
systems are incredibly slow without hardware assist.


so, you might ask, if virtual machines are so expensive, why would
anyone use one?

the answer is that it isnt _that_ expensive if the operating system is
simple and it doesnt do virtual memory and it doesnt use a supervisor
mode, and programs running on the virtual machine are mostly cpu
intensive or limited by user interaction.

the other reason why you would want to do it is because lots of real
cpus are too expensive and you are doing operating system
development or testing.  for 386's, this wouldnt apply at all, but for
ibm mainframes, having 10 extra cpu's just to do operating system
development is _real_ expensive.  also, when you are bringing up a new
release of an operating system, taking the main system down for a day
or two is unacceptable.  thats why _i_ would bring up copies of VM/CMS
under VM/CMS.  i was testing new versions of the operating system.  it
was neat to do, but it was _real_ slow.


so, anyway, i really doubt that intel will ever let you run virtual
286's, 386's, or 486's.  8088's arent too bad 'cause they dont have
virtual memory or supervisor states, but everything else is just not
worth it.


-wayne