Previous Topic: 6.4 Operating System Details

Next Topic: 6.4.2 Shadow Table Maintenance

6.4.1 Instruction Simulation


To allow an operating system to run in a virtual machine, VM
must allow all System 370 facilities and resources to be used
by the operating system.  However, in order to run more than
one virtual machine at a time, VM must share the real
facilities and resources among all the virtual machines in
the system.  This includes real memory, I/O devices, and CPU
time.  Virtual machines occasionally interfere with one
another in their use of system facilities and CP must control
the interferences using instruction simulation.

Certain instructions in a 370 system are known as privileged
instructions.  These instructions must be executed while the
system is in supervisor state.  VM owns the real hardware.
In order to protect the virtual machines from each other and
to protect itself from virtual machines, CP (the VM
supervisor or control program) allows only a virtual machine
to run in problem state.

CP is the only entity that runs in supervisor state in a VM
system.  This is known as real supervisor state.  Virtual
machines run in real problem state (with some exceptions
noted later).  This presents a problem for the operating
system in the virtual machine:  it expects to be able to
execute privileged instructions, but CP has prevented it from
doing so by running the virtual machine in problem state.  CP
solves this problem by intercepting the hardware interrupt
generated by the attempt to execute a privileged instruction
while the system is in real problem state.  CP then
determines whether the operating system in the virtual
machine believes that it is running in supervisor state (this
is termed virtual supervisor state) and, if so, enters
instruction simulation to provide the function of the
instruction to the virtual machine.

In the area of I/O, CP must intercept the I/O instructions
for simulation.  For start commands (SIO, SIOF, SSCH, etc.),
CP must also translate the channel program so that the
storage addresses provided by the virtual machine are
converted to real addresses.  In addition, CP performs
cylinder relocation for DASDs that are shared, so that the
virtual machine will read or write the correct area on the
disk.  Then, CP translates the address of the device provided
by the virtual machine to the address of the real device
before starting the I/O operation.

The process of instruction simulation can be very time-
consuming and CPU-intensive.  To improve performance, a
number of assists are available for VM systems:

o  370-mode systems consist of VMA (virtual machine assist),
   ECPS (extended control program support), and PMA
   (preferred machine assist).  These facilities allow the
   execution of some privileged instructions by an operating
   system in a virtual machine even though the real system is
   in problem state.  PMA provides additional performance
   improvements by allowing a single virtual machine to
   execute in real supervisor state.  This eliminates CP
   intervention in I/O to devices owned by the virtual
   machine, as well as eliminating most of the instruction
   simulation for the virtual machine.

o  For XA mode systems, the performance assists are a part of
   SIE (the start interpretive execution instruction).  SIE
   is a composite of the 370 VM assists, with additions
   applicable to VM/XA.

o  SIE Assist is a feature of SIE.  This feature allows the
   virtual machine operating system to initiate I/O
   operations to a device that has been dedicated to the
   exclusive use of the virtual machine without CP having to
   perform any translation or relocation.

The development of VM and of hardware assists for VM has
reduced the overhead in CP to support a virtual machine to
the point that, in many cases, it is almost negligible.