Virtual Machines Dr
Total Page:16
File Type:pdf, Size:1020Kb
Virtual Machine (VM) Layered model of computation Software and hardware divided into logical layers Layer n Receives services from server layer n – 1 Provides services to client layer n + 1 Virtual Layers interact through well-defined programming interface Virtual layer Machines Software emulation of hardware or software layer n Transparent to layer n + 1 Provides service to layer n + 1 as expected from real layer n Virtual layer n can run at some layer m ≠ n in real system n + 1 n + 1 n virtual n = m n –1 m –1 Virtual System Real System Modern Microprocessors — Fall 2012 Virtual Machines Dr. Martin Land 1 Modern Microprocessors — Fall 2012 Virtual Machines Dr. Martin Land 2 Examples of Virtual Systems Types of Virtual Machine Web browser exchanges data with server Process Virtual Machine VM provides application interpretation above OS Browser virtual Web server Hosted Virtual Machine Local OS Server OS Protocol Protocol Virtual machine monitor (VMM) Stack Stack Runs above primary OS / below guest OS real real Hardware Network Hardware Provides guest OS with software emulation of real hardware system Client Server System Virtual Machine Emulation of system-level hardware environment Cloud computing Runs above physical hardware and below one or more OSs Virtual Service level agreement (SLA) specifies infrastructure requirements Application Application Application Application Application User sees hardware / software configuration / performance VM Real OS OS Guest OS OS Provider assembles virtual configuration VMM VMM Meets SLA requirements Hardware OS Hardware May be implemented in any way Hardware Hardware Basic System System VM Hosted VM Process VM Modern Microprocessors — Fall 2012 Virtual Machines Dr. Martin Land 3 Modern Microprocessors — Fall 2012 Virtual Machines Dr. Martin Land 4 Process VM Example —Java Hosted VM Example — Guest OS Over OS Designed for program portability between platforms DOS command line interface over Windows Windows allocates 1 MB virtual memory space Provides standard interface to software debug Copies DOS kernel into low memory Windows Java VM located above a standard OS Application Virtual 86 System calls handled by guest DOS kernel Interface to hardware implementation dependent DOS accesses to hardware Windows I/O operations performed by calls to OS Trapped and served by Windows host OS Java compiled to bytecode Responses returned to DOS Hardware Bytecode usually run (interpreted) in Java VM Concurrent DOS windows Multiple allocations of 1 MB virtual memory spaces DEBUG Application running in virtual DOS machine Java without VM Sees 1 MB memory space allocated by Windows Java bytecode processor in IBM mainframes Register values Native machine language (ISA) is Java bytecode Windows emulates real values to DOS Execute Java bytecode without interpretation Debug emulates DOS values to user Parallels, VirtualBox, VMware, DOSBox, ... Host Windows, Linux, DOS, … as guest OSs over host OS http://java.sun.com/docs/books/tutorial/getStarted/intro/definition.html Modern Microprocessors — Fall 2012 Virtual Machines Dr. Martin Land 5 Modern Microprocessors — Fall 2012 Virtual Machines Dr. Martin Land 6 Virtual Machine in IBM z/990 Mainframe VM as System Management Tool Hardware Isolate user environments on single hardware platform CPUs, I/O system, internal communication network Multiple copies of single operating system running independently VMM (hypervisor) Multiple operating systems running concurrently Operator console for partitioning/configuring CPUs and I/O Maintain higher security Provides hardware emulation as abstraction to OS layer OS Logical partition (LPAR) runs separate instance of operating system App1 App2 App2 App3 Resource management Run z/OS, MVS, VM, Unix, Linux, Windows, … instances in parallel OS OS OS OS Non-Windows OS versions expect to see hypervisor (not hardware) Hardware redundancy User High availability VMM VMM Recovery management User sees single-user interface provided by one OS Server Server Hardware pooling User … User User … User User … User User … User User … User Assemble hardware cluster OS — LPAR OS — LPAR OS — LPAR … OS — LPAR Map applications to hardware efficiently VMM — Systems Manager — Hypervisor Load balancing Remap applications to hardware Hardware Modern Microprocessors — Fall 2012 Virtual Machines Dr. Martin Land 7 Modern Microprocessors — Fall 2012 Virtual Machines Dr. Martin Land 8 z/990 Parallel Sysplex Model Virtualization for Server Systems Parallel Sysplex Old file server model Merge 2 to 32 instances of z/OS into a single system Run one application per physical server Applications divide work and data among LPARs Server specified for worst case load High capacity for very large workloads Large number of typically underutilized servers Resource sharing Huge aggregate space capacity Dynamic workload balancing Competition from mainframes Geographical diversity VMM provides dynamic load balancing Coupled LPARs on remote physical systems Hardware provides centralized power, cooling, monitoring, backup Physical backup User … User User … User User … User User … User User … User High SAR — scalability, availability, reliability Automatic failure recovery LPAR - OS LPAR - OS LPAR - OS … LPAR - OS Lower cost per served client than server farm Continuous availability Systems Manager Hardware (processors, RAM, I/O) Virtualization in server Partition hardware resources to run independent applications User … User User … User User … User User … User User … User LPAR - OS LPAR - OS LPAR - OS … LPAR - OS Intel virtualization Coupling Systems Manager IA-32 and IA-64 ISA support Facility Hardware (processors, RAM, I/O) I/O chipset support Modern Microprocessors — Fall 2012 Virtual Machines Dr. Martin Land 9 Modern Microprocessors — Fall 2012 Virtual Machines Dr. Martin Land 10 HP Virtual Partitions (vPars) System VM Organization Hypervisor Virtual machine monitor (VMM) Lowest layer above physical hardware (host) Uniprocessor or multiprocessor system Creates virtual machine (VM) environments for guest OSs Allocates physical host resources to virtual resources VM overhead Processor intensive applications — low overhead Infrequent use of OS calls Most instructions run directly on hardware I/O intensive applications — high overhead Frequent use of OS calls Boot OS calls for I/O services run in emulation Order I/O-limited applications Program throughput limited by I/O latency Emulation adds relatively small overhead Hewlett-Packard, "Installing and Managing HP-UX Virtual Partitions (vPars)" Modern Microprocessors — Fall 2012 Virtual Machines Dr. Martin Land 11 Modern Microprocessors — Fall 2012 Virtual Machines Dr. Martin Land 12 VMM Requirements Virtualization Awareness Hardware abstraction Virtualization-aware guest OS Guest environment must replicate hardware OS written to run above VMM/hypervisor VMM must present well-defined software interface to OS Expects to interact with virtual host Does not expect full or direct control of physical hardware Protection OS code interfaces with hypervisor code Isolate guests from one another No need to remap (bluff) pointers intended for real hardware Protect VMM from guest OS and application software May be presented with view of real system for limited operations Guest software cannot change allocation of physical resources Example — mainframe OS Privilege Writes I/O outputs to hypervisor interface VMM runs in kernel mode Does not attempt to configure I/O hardware devices Guest OSs and applications run in user mode Particular OS may be given direct control of particular I/O device Hardware support for VMM Virtualization-unaware guest OS Virtualization primitives built into mainframe ISA OS written to run above physical hardware Any OS or application access to hardware causes trap to VMM Expects full and direct control of real hardware VMM catches every access to hardware abstraction layer (HAL) Requires extensive intervention and remapping by VMM Modern Microprocessors — Fall 2012 Virtual Machines Dr. Martin Land 13 Modern Microprocessors — Fall 2012 Virtual Machines Dr. Martin Land 14 Hardware Emulation Activities Full/Partial System Emulation OS sees hardware through operations Full system emulation OS instructions cause to CPU initiate memory and I/O operations VMM intervenes in every OS access to hardware I/O devices initiate DMA operations and interrupts CPU Translates guest ISA to host ISA Application Memory Translates memory size and organization Real Operation VMM Emulation OS Chipset Translates guest configuration instructions to host Hardware I/O devices Translates guest driver to host driver VMM CPU Read data or Translate data/instruction from guest to host format Memory instruction Remap address space Hardware CPU emulation example Access Write data Read/Write to real host memory Run Nintendo game on PC CPU I/O Read data or Translate data/instruction from guest to host format Translate each Nintendo instruction to IA-32 instruction set Device instruction Remap I/O port space Partial system emulation Access Write data Read/Write to real host I/O device Part of host hardware presented to OS unchanged VMM manages I/O device DMA VMM passes guest operations to host with minimal intervention I/O device DMA or IRQ actions Translate OS interrupt handlers from guest Most system VMs emulate subset/superset of real host hardware format to host format CPU emulation only in special cases Modern Microprocessors — Fall 2012 Virtual Machines Dr. Martin Land 15 Modern Microprocessors — Fall 2012 Virtual Machines Dr. Martin Land