100 likes | 224 Vues
This module on virtualization provides an in-depth examination of the abstraction of computing resources, explaining how it hides physical characteristics and allows for multiple instances of a resource. It covers the importance of resource sharing, fault isolation, and encapsulation. It discusses various types of virtualization such as platform, OS-level, and hardware-assisted virtualization, along with their complexities, requirements, performance issues, and the differences between emulation and native virtualization. The module highlights historical context and modern applications in computing.
E N D
CSE 451: Operating SystemsWinter 2012Module 18Virtual Machines Mark Zbikowski and Gary Kimura
What is “Virtualization”? • Beyond the buzz-word du jour: • Abstraction of computing resources • Hide the physical characteristics of a resource • Allow multiple “instances” of the resource • Why? • Sharing the resource among multiple clients • Disks (I/O system) • Cpu (scheduler and context switches) • Memory (processes and virtual memory) • Fault isolation • Application • Operating System • Hardware(!)
Classes of Virtualization • Resource • aggregation, spanning, or concatenation combines individual components into larger resources or resource pools (RAID) • VPN or NAT • Multiprocessor/multicore • Encapsulation: hide complexity by the creation with simplified interface.
Classes of Virtualization • Platform • 1960’s term: virtual machines used hardware and software • Host running sofware using hardware assistance to execute a guest • Guest can be application or entire OS • Guest runs as if it were installed on bare metal • Typically many guests run on a single host
Platform Virtualization – What? • Emulation/simulation • Software/hardware decodes each instruction and emulates the guest hardware • Emulate completely different CPU (VirtualPC on PowerPC Mac) • Typically slow (but some clever tricks can be used) • Native/Full Virtualization • Host emulates only enough hardware to allow guest to run unmodified • OS-Level Virtualization • “personalities” • Underlying OS emulates programming environment: Win32, POSIX, OS/2
Platform Virtualization – How? • Emulation/Simulation • Naively, very slow: decode and execute instruction • Why not play compiler? • “dynamic recompilation” • Decode sequence of guest instructions (basic block) • Generate native host instructions • Hash table of guest address -> codelet block • Memory management emulation difficult • Simulate page directory/table and TLB • Java VM and VirtualPC
Platform Virtualization – Difficulties • Requirements • Fidelity: guest executes identically to execution on native hardware, barring timing effects • Performance: an overwhelming majority of guest instructions are executed by the hardware without intervention by host • Safety: host manages all hardware resources • X86 is not classically virtualizable • Run guest in unprivileged mode (“deprivileging”) • Trap to host on illegal instructions, emulate effects in guest • Illegal instructions: • CR (chip control registers) • I/O port • Memory-mapped devices
More x86 woes • Primary and shadow structures • Host maintains shadows of guest’s primary structures • On-CPU state: • Page directory pointer • Processor status register (interrupt state, flags, debug state) • Trivial to maintain • Off-CPU state: • Page tables • Encodes mappings and permissions • Modified by guest AND guest H/W
Improving host performance • Allow slightly modified guests • Augment the “hardware” to add host-calls • VMWare Tools/VirtualPC Machine Additions • Device drivers that export the I/O at a high level for emulation • Dynamic recompliation • Hardware extensions • Intel VMRUN VMEXIT instructions • Hardware maintains shadow state • Traps to host when needed • Too limited to be of value
Platform Virtualization • Emulating an “environment” • “Win32 API” implemented on Windows 95 • Native API to DOS/Win-based kernel • Windows NT built to allow emulation • DLLs in application address space emulate Windows 95 API but run on an entirely different operating system • Vast majority of Windows 95 applications ran on Windows NT 4 without modification • Java • Byte-code defines a virtual machine • Emulator written in portable C, can be compiled and run on almost all hardware architectures • Pcode can be run anywhere • Dynamic recompilation (aka incremental compilation)