• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Virtual Machines Background Adapted from Silberschatz
 

Virtual Machines Background Adapted from Silberschatz

on

  • 633 views

 

Statistics

Views

Total Views
633
Views on SlideShare
633
Embed Views
0

Actions

Likes
0
Downloads
12
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • What kind is VMware?

Virtual Machines Background Adapted from Silberschatz Virtual Machines Background Adapted from Silberschatz Presentation Transcript

  • Virtual Machines Background Adapted from Silberschatz
  • Virtual Machines
    • A virtual machine takes the layered approach to its logical conclusion. It treats hardware and the operating system kernel as though they were all hardware.
    • A virtual machine provides an interface identical to the underlying bare hardware.
    • For example, the operating system creates the illusion of multiple processes, each executing on its own processor with its own (virtual) memory.
  • Virtual Machines (Cont.)
    • The resources of the physical computer are shared to create the virtual machines.
      • CPU scheduling can create the appearance that users have their own processor.
      • Spooling and a file system can provide virtual card readers and virtual line printers.
      • A normal user time-sharing terminal serves as the virtual machine operator’s console.
  • System Models Non-virtual Machine Virtual Machine
  • Advantages/Disadvantages of Virtual Machines
    • The virtual-machine concept provides complete protection of system resources since each virtual machine is isolated from all other virtual machines. What might be bad about this?
      • This isolation, however, permits no direct sharing of resources.
    • A virtual-machine system is a perfect vehicle for operating-systems research and development. System development is done on the virtual machine, instead of on a physical machine and so does not disrupt normal system operation.
    • The virtual machine concept is difficult to implement due to the effort required to provide an exact duplicate to the underlying machine.
  • Java Virtual Machine
    • Compiled Java programs are platform-neutral bytecodes executed by a Java Virtual Machine (JVM).
    • JVM consists of
    • - class loader
    • - class verifier
    • - runtime interpreter
    • Just-In-Time (JIT) compilers increase performance
  • Java Virtual Machine
  • An Overview of Virtual Machine Architectures Smith and Nair
  • Definitions
    • Instruction Set Architecture (ISA)
      • Precise specification of the interface between hardware and software
    • Application Binary Interface (ABI)
      • Defines how an application can work with a platform at the binary level. (Contrast with API.)
      • Includes user ISA, system call interface, etc.
      • Suppose an ABI is changed.
        • Recompile?
        • Source changes?
  • Virtualization
    • VMM also known as hypervisor.
    Hardware OS Application ISA Hardware OS Application Virtual ISA VMM ISA Guest Host OS Application Virtual ISA Virtual Machine
  • Virtual Machine Uses
    • Emulation
      • One ISA can be used to emulate another.
      • Provides cross-platform portability.
    • Optimization
      • Emulators can optimize as they emulate.
      • Also can optimize same ISA to same ISA.
    • Replication
      • A single physical machine can be replicated, providing isolation between the VMs.
    • Composition
      • Two virtual machines can be composed, combining the functionality of each.
  • Process vs. System
    • Meaning of “machine” depends on perspective.
      • To a process, the machine is the system calls, libraries, etc.
        • Already abstract.
      • The entire system also runs on a machine.
        • Includes ISA, actual devices, etc.
      • Other kinds of machines?
    • As there are two perspectives, there are two kinds of virtual machines: process and system.
      • Process virtual machine can support an individual process.
      • System virtual machine can run a complete OS plus environment.
  • Process vs. System x86 Linux Java VM Native App Native App Java VM Java Prog Java Prog x86 Linux VMM Native App Native App W32 App Windows W32 App Process VM System VM Examples?
  • Process VMs
    • Multiprogramming
      • A process has the illusion of having the whole machine to itself.
    • Emulation
      • Interpreted. (Define.)
      • Translated. (Define.)
      • What are relative merits?
    • Dynamic optimizers
      • Especially useful with some kind of profile-directed translation.
    • High Level Language VMs
      • High-level language is compiled to an intermediate language.
      • VM then runs the intermediate language.
      • Example is Java: Interpreted or translated?
  • System VMs
    • Same ISA
      • “ Classic” (Define. Pros/cons?)
        • VMM built directly on top of hardware.
        • Most efficient, but requires wiping the slate clean.
        • Requires device drivers in the VMM.
      • Hosted (Define. Pros/cons?)
        • VMM built on top of existing OS.
        • Most convenient
        • Devices drivers supplied by host OS, VMM uses facilities provided by host OS.
    • Different ISA
      • Whole System VMs: Emulation
        • ISA not the same, must emulate everything.
      • Co-Designed VMs: Optimization
        • Hardware designed to support VMs.
        • Provides a clean design for virtualization.
        • Can be significantly more efficient.
  • Virtualization
    • The state of a machine must be maintained.
      • Physical machine: latches, flip-flops, etc.
      • Virtual machine: combination of physical machine and state emulated in software using RAM, etc.
    • At certain points in execution, such as a trap, the state of the machine must be “materialized”.
      • Not trivial due to complex hardware techniques used to provide high performance.
      • This ability to materialize the state is termed “preciseness”.
    • Three aspects of virtualization
      • State: registers and memory
      • Instructions: may involve emulation
      • State materialization: when exceptions occur
  • Process VMs Virtualization
    • Multiprogramming
      • State
        • Mapped 1:1
      • Instructions
        • Native
      • State materialization
        • Provided by hardware
    • Dynamic translation
      • State
        • Registers mapped to host registers as available (overflow to memory). Memory mapped to host memory.
      • Instructions
        • Emulated
      • State materialization
        • Provided by VM software
    • HLL VMs
      • State
        • Mapped to host resources as available.
      • Instructions
        • Emulated, JIT compiled
      • State materialization
        • Provided by VM software
  • System VMs Virtualization
    • “ Classic” VMs
      • State
        • Mapped 1:1, except for privileged registers.
      • Instructions
        • Native, except trapping for priveleged instructions
      • State materialization
        • Provided by hardware
    • Whole System VMs
      • State
        • Mapped to available memory, not 1:1
      • Instructions
        • Emulated
      • State materialization
        • Provided by VM software
    • Co-Designed VMs
      • State
        • Mapped 1:1
      • Instructions
        • Block-level translated
      • State materialization
        • Provided by hardware/VM software combination
  • Taxonomy
    • Process
      • Same ISA
        • Multiprogramming
        • Dynamic optimization
      • Different ISA
        • Dynamic translators
        • HLL VM
    • System
      • Same ISA
        • “ Classic” OS VMs (IBM)
        • Hosted VMs
      • Different ISA
        • Whole system
        • Co-designed VMs
  • Key Ideas
    • VMs can support an individual process only, or can support a whole OS.
    • Can construct a useful taxonomy based on:
      • process or system
      • same ISA or different ISA
  • Virtualizing I/O Devices on VMware Workstation’s Host VMM
  • Virtualizing the PC Platform
    • Several hurdles
      • Non-virtualizable processor
        • Some privileged instructions fail silently. (Why is this a problem?) (What’s the solution?)
      • PC hardware diversity
        • Why is this problematic for a “classic” VM?
      • Pre-existing PC software
        • Must stay compatible
    • To address these, VMware uses a hosted VM. (Not a “classic” VM.)
  • Two Worlds
    • VMApp runs in the host, using the VMDriver host kernel component to establish the VMM.
    • CPU is thus executing in either the host world or the virtual world, using VMDriver to switch worlds.
    • World switches are expensive, since user and system state must be switched.
  • Virtualizing the NIC
    • I/O port operations by guest OS must be intercepted by VMM.
      • Must then be processed in the VMM (to maintain the virtual state).
      • Or executed in the host world. (When must it do what?)
    • Send operations start as a sequence of ops to virtual I/O ports.
      • Upon finalization of the send, the VMApp issues a host OS syscall to the VMNet driver, which passes it on the real NIC.
      • Finally requires raising a virtual IRQ to signal completetion.
    • Receive operations operate in reverse.
      • VMApps executes select() syscall on possible sources.
      • Reads packet, forwards it to VMM which raises a virtual IRQ.
  • Reducing Network Virtualization Overheads
    • Handling I/O ports in the VMM
      • Many accesses don’t involve actual I/O.
      • Let the VMM maintain the state, avoiding a worlds switch.
    • Send combining
      • If data rate is high, queue up packets, send them in a group.
    • IRQ notification
      • Use shared memory bitmap rather than requiring VMApp to call select() when an IRQ is received on the host system.
  • Performance Enhancements
    • Reducing CPU virtualization overhead
      • Find operations to the interrupt controller that have memory semantics and replace with MOV operation, which does not require intervention by the VMM.
      • Apparently requires dynamic binary translation.
    • Modifying the guest OS
      • Eliminate idle task page table switching, which is not necessary, since the idle task pages are mapped in every process page table.
      • Run idle task with page table of last process.
      • What would happen if the idle task had a bug and wrote to some random addresses?
  • Performance Enhancements
    • Creating a custom virtual device
      • Virtualizing a real device is somewhat inefficient, since the interface to these devices is optimized for real devices, not virtual devices.
      • Designing a custom virtual device can reduce expensive operations.
      • Disadvantage is that must write a new device driver in guest OS for this virtual device.
    • Modifying the host OS
      • VMNet driver allocates kernel memory sk_buff , then copies from VMApp to sk_buff .
      • Can eliminate copy by using memory from VM physical memory.
    • Bypassing the host OS
      • VMM uses own drivers, rather than going through the host OS. (Note that going through the host OS is using a kind of process VM provided by the host OS.)
      • Disadvantage is that you have to write your own VMM driver for every supported real device.
  • Summary
    • Main goal is to develop some understanding of the issues of hosted system VM performance.
  • Xen and the Art of Virtualization
  • Motivation of Xen
    • Server farm scenario
      • Multiple applications installed on machines.
        • Configuration interaction between apps (like versions of Java jars, shared libraries, etc.) can lead to compatibility problems requiring time-consuming system administration to solve.
        • Behavior of one app can impact performance of another. Need performance isolation.
      • Instead use multiple VMs, one VM per app.
        • Each app can configure the entire OS exactly how it requires.
        • Relatively easier to implement algorithms at the VM level to isolate the performance behavior of different apps.
    • To avoid performance penalties of VMs like VMware, use paravirtualization.
  • Design Principles
    • Support for unmodified binaries is essential.
      • Must virtualize all features required by existing ABIs.
    • Support for full multi-app OSs is important. (Not just process VMs.)
      • Complex configurations may have multiple processes and should be configured within a single VM.
    • Paravirtualization is necessary to obtain high performance and strong resource isolation.
      • For example, virtualizing page tables can result in many expensive traps.
    • Even on ISAs designed for virtualization, completely hiding the virtualization from guest OS risks correctness and performance.
      • For example, the VM should know real time (and not just virtual time) to handle things like timeouts.
  • The VM Interface Overview
    • Memory management
      • Paging
        • Xen in top 64 MB of every AS, avoiding TLB flush for hypervisor transitions.
        • Guest OSs update actual hardware page tables through Xen, which improves performance. (But makes them aware of virtualization.)
      • Segmentation
        • Cannot install fully privileged segment descriptors.
  • The VM Interface Overview (contd.)
    • CPU
      • Protection
        • Guest OS must run at lower privilege. Since ring 1-2 seldom used, run guest OS in ring 1.
      • Exceptions
        • Guest OSs must register handlers with Xen. Only page fault handler must be modified to not read from privileged register.
      • System Calls
        • “ Fast” handlers may be registered to avoid going through ring 0. (This seems to change the ABI. Non-dynamically binaries will need to be recompiled.)
      • Interrupts
        • Replaced with event system.
      • Time
        • Each guest OS has a time interface and is aware of real and virtual time.
    • Device I/O
      • Network, Disk, etc.
        • All replaced with special, buffer-based event mechanism.
  • Details
    • Hypercalls
      • Explicit calls into the hypervisor by the guest OS. Used by guest OS for things like updating hardware page tables.
    • Time and timers
      • Guest OSs made aware of real time and virtual time.
        • Virtual time advances only when the guest OS is executing. Used for scheduling by the guest OS.
      • Xen-provided timers are used by guest OS.
        • Solves one efficiency problem with VMware Workstation.
          • Guest XP causes host to perform poorly, because must constantly deliver timer interrupts to XP to do things like smooth transition animations (like minimizing a window, etc.). Forcing the guest to use XP provided timer would eliminate the need to virtualize these timer interrupts.
    • Physical memory
      • Reserved for each guest OS instance at time of creation.
        • Provides strong isolation.
    • Disks
      • Isolation is tricky, but batching of requests provides some degree of it.
  • Performance
    • Generally good performance.
    • Unfortunately, comparisons with a number of products not publishable due to licensing.
    • Isolation tests were better than expected, given the currently weak disk isolation.
  • Key Ideas
    • A virtual ISA (paravirtualization) is better.
      • Better performance
      • Allows VMs to be isolated from one another. One VM can’t cause the other to thrash, for instance.
      • Allows up to 100 OS instances
      • Making the guest OS aware of virtualization improves correctness and performance
    • Control and management of Xen itself is done from a guest OS, via a special interface.
  • Microkernels Meet Recursive Virtual Machines Ford et al
  • Decomposition
    • Microkernels decompose functionality horizontally (mainly).
      • Monolithic services separated horizontally.
      • Moved up one layer.
    • Stackable VMMs decompose functionality vertically.
      • Each layer supplies some functionality.
  • Fluke
    • Uses a nested process architecture.
      • Each process provides a VM to its children, possibly with additional functionality.
      • Different from usual parent-child in that children are completely contained within and visible to parent.
      • This is necessary for the parent to be a VM to its children.
    • Two APIs
      • Low-level kernel API to microkernel for basic manipulation
      • High-level protocols to handle:
        • Parent Interface
        • Process
        • MemPool
        • FileSystem
      • Nested VMs interact directly with microkernel for the low-level API, but interact with the parent VM for high-level protocols.
      • Parent VM will use interposition to add additional functionality. This is how the stacking works.
  • Key Ideas
    • Implement a microkernel that allows process virtual machines to be stacked.
    • Each virtual machine is a user-level server.
    • Stacking occurs through process nesting.
    • Use pass-through to avoid exponential behavior.
    • Mainly interesting for the ideas, performance is relatively poor, but may be improvable.