Virtual Machine Operating Systems

Table of Contents

1 multi-user operating systems

1.1 share (expensive) computing resources among multiple users

1.2 prevent users from interfering with each other

  • or prevent buggy software from causing bigger problems

1.3 prevent users from crashing operating system or damaging hardware

  • some hardware can actually be damaged by misprogramming
  • arbitrate multiple tasks trying to access the same hardware features

1.4 provide higher-level programming facilities

  • simplify user programming
  • hide differences between types of hardware with different interfaces

1.5 operating system interface may be very different from hardware interface

  • hardware interface
    • special instructions
    • separate address space for I/O devices
    • I/O devices accessed through normal memory addresses ("memory-mapped")
  • OS interface
    • similar to special subroutine calls

2 How do multi-user OSes do these things?

2.1 user/supervisor modes for CPU

  • supervisor mode has unrestricted access to system
  • user mode limits use of instructions that might subvert OS
    • task control
    • interrupt control
    • instructions that manipulate I/O devices
    • illegal user instructions trap into OS
      • return exception to task
      • terminate misbehaving task

2.2 memory protection and virtual memory

  • memory addresses are mapped from virtual (used by tasks) to physical (for hardware memory access) by lookup tables
  • access to unmapped memory traps into OS
    • restart trapping instruction after modifying mapping
    • return exception to task
    • terminate misbehaving task
  • each task has memory distinct from other tasks
  • tasks can share identical regions of memory
    • program code
    • library code
    • read-only data
  • memory can also be shared for inter-task communication
  • limit access to memory-mapped I/O devices

3 virtual machine hypervisors as a type of multi-user operating system

3.1 analogy - OS : task :: hypervisor : "guest" OS

3.2 use user/supervisor mode and memory protection to emulate low-level hardware

  • hypervisor runs in supervisor mode
  • virtual machine runs in user mode
    • supervisor-mode instructions trap into hypervisor for emulation
    • hypervisor tracks virtual user/supervisor modes
  • use memory protection to emulate memory-mapped I/O
    • memory-mapped I/O region is unmapped or protected
    • guest OS access traps into hypervisor, which emulates I/O action

3.3 multitasking architectures may not always work for hypervisors

  • it must be possible to trap, emulate, and restart any supervisor-mode instruction executed in user mode
  • an architecture supporting full hardware virtualization can even run a hypervisor as a guest of another hypervisor (VMception!)
  • Intel x86 did not initially support full hardware virtualization
    • VMware used dynamic code translation to replace nonvirtualizable instructions

3.4 paravirtualization

  • hypervisor provides an interface easier/more efficient to emulate than the raw hardware interface
  • requires custom guest OS kernels (therefore less suitable for running multiple or abitrary OSes on a host)
  • can perform better than ideal hardware virtualization

4 Why virtual machines?

4.1 great for OS development

  • debugging a crashed OS in hardware is tedious
  • hypervisor can provide software tools for debugging

4.2 multitasking for single-user OSes

  • common application for IBM 370 VM/SP

4.3 hardware consolidation

  • applications on a dedicated hardware server often don't use all its resources
  • multiple VMs be collectively better at using host CPU or memory at full utilization
  • less hardware, electrical power, space needed for the same set of applications

4.4 configuration flexibility

  • properties of a VM (number of CPUs, memory, attached I/O devices) can be changed easily in software
  • VM can be moved from one host to another more easily than hardware can be relocated
    • some environments support nondisruptive migration
    • others may require rebooting the VM

Author: Steve VanDevender

Created: 2016-06-20 Mon 12:54

Emacs 24.5.1 (Org mode 8.2.10)

Validate