Virtual Machine Monitors

Slides:



Advertisements
Similar presentations
CS-3013 & CS-502, Summer 2006 Virtual Machine Systems1 CS-502 Operating Systems Slides excerpted from Silbershatz, Ch. 2.
Advertisements

Architectural Support for OS March 29, 2000 Instructor: Gary Kimura Slides courtesy of Hank Levy.
G Robert Grimm New York University Disco.
1 CS 333 Introduction to Operating Systems Class 2 – OS-Related Hardware & Software The Process Concept Jonathan Walpole Computer Science Portland State.
Disco Running Commodity Operating Systems on Scalable Multiprocessors.
November 1, 2004Introduction to Computer Security ©2004 Matt Bishop Slide #29-1 Chapter 33: Virtual Machines Virtual Machine Structure Virtual Machine.
Virtualization for Cloud Computing
Virtual Machine Monitors CSE451 Andrew Whitaker. Hardware Virtualization Running multiple operating systems on a single physical machine Examples:  VMWare,
E Virtual Machines Lecture 4 Device Virtualization
A Survey on Virtualization Technologies
Tanenbaum 8.3 See references
Microkernels, virtualization, exokernels Tutorial 1 – CSC469.
A Survey on Virtualization Technologies. Virtualization is “HOT” Microsoft acquires Connectix Corp. EMC acquires VMware Veritas acquires Ejascent IBM,
Virtualization Concepts Presented by: Mariano Diaz.
Virtualization Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation is licensed.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto OS-Related Hardware.
CS533 Concepts of Operating Systems Jonathan Walpole.
Operating Systems David Goldschmidt, Ph.D. Computer Science The College of Saint Rose CIS 432.
 Virtual machine systems: simulators for multiple copies of a machine on itself.  Virtual machine (VM): the simulated machine.  Virtual machine monitor.
Virtual Memory Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University.
1 CSE451 Architectural Supports for Operating Systems Autumn 2002 Gary Kimura Lecture #2 October 2, 2002.
Introduction to virtualization
Full and Para Virtualization
Lecture 26 Virtual Machine Monitors. Virtual Machines Goal: run an guest OS over an host OS Who has done this? Why might it be useful? Examples: Vmware,
1 Lecture 1: Computer System Structures We go over the aspects of computer architecture relevant to OS design  overview  input and output (I/O) organization.
12/2/091 What is an Operating System Andy Konwinski CS61CL Dec 2, 2009 Lecture 13 UCB CS61CL F09 Lec 13.
Protection of Processes Security and privacy of data is challenging currently. Protecting information – Not limited to hardware. – Depends on innovation.
CSE 451: Operating Systems Winter 2015 Module 25 Virtual Machine Monitors Mark Zbikowski Allen Center 476 © 2013 Gribble, Lazowska,
Running Commodity Operating Systems on Scalable Multiprocessors Edouard Bugnion, Scott Devine and Mendel Rosenblum Presentation by Mark Smith.
Unit 2 VIRTUALISATION. Unit 2 - Syllabus Basics of Virtualization Types of Virtualization Implementation Levels of Virtualization Virtualization Structures.
Lecture 13: Virtual Machines
Introduction to Operating Systems Concepts
Virtualization for Cloud Computing
Introduction to Virtualization
Virtualization.
Operating System & Application Software
Xen and the Art of Virtualization
Presented by Yoon-Soo Lee
Protection and OS Structure
CS352H: Computer Systems Architecture
Desktop Virtualization
Chapter 1: Introduction
Lecture 24 Virtual Machine Monitors
Morgan Kaufmann Publishers
Morgan Kaufmann Publishers
Morgan Kaufmann Publishers Large and Fast: Exploiting Memory Hierarchy
What is an Operating System?
Group 8 Virtualization of the Cloud
Introduction to Operating Systems
OS Virtualization.
Virtualization Techniques
A Survey on Virtualization Technologies
Chapter 33: Virtual Machines
Architectural Support for OS
Computer Security: Art and Science, 2nd Edition
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
CSE 451: Operating Systems Autumn 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 596 Allen Center 1.
CSE 451: Operating Systems Autumn 2001 Lecture 2 Architectural Support for Operating Systems Brian Bershad 310 Sieg Hall 1.
CSE 451: Operating Systems Autumn Module 24 Virtual Machine Monitors
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
Introduction to Virtual Machines
CSE 451: Operating Systems Winter 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 412 Sieg Hall 1.
Architectural Support for OS
Introduction to Virtual Machines
Operating Systems Structure
Xen and the Art of Virtualization
Operating Systems Structure
Virtual Memory Use main memory as a “cache” for secondary (disk) storage Managed jointly by CPU hardware and the operating system (OS) Programs share main.
CSE 451: Operating Systems Autumn Module 24 Virtual Machine Monitors
Chapter 33: Virtual Machines
Presentation transcript:

Virtual Machine Monitors CSE451 Andrew Whitaker

Hardware Virtualization Running multiple operating systems on a single physical machine Examples: VMWare, Microsoft’s VirtualPC / VirtualServer, Parallels (Macintosh), Xen

Virtual Machine Monitors Type I VMM runs on the raw hardware Type II VMM runs hosted on another OS Windows virtual machine Linux virtual machine virtual machine monitor hardware

VMM History Conceived by IBM in the late 1960’s Popularized by VM/370 (1972) Used for OS debugging, time sharing, supporting multiple OS’s Batch processing OS Time sharing OS VM/370 System 370 Machine

VMMs Today OS development and debugging Software compatibility testing Running software from another OS Or, OS version Virtual infrastructure for Internet services

Internet Services Many applications now run inside the Internet Search engines, maps, photo sharing, email, IM, game servers, etc. Goal: allow anyone to upload to a new service into the Internet Must be low-cost, secure, robust, easy to maintain, etc. Approach: use VMMs to provide a rent-a-server economy

Amazon’s Elastic Compute Cloud (EC2) Provide service developers with a set virtual machines and storage resources Scalability New machines can be created in minutes Security Virtual machines provide stronger isolation than OS processes Developer control Developers choose the OS, software, libraries, etc. Low cost Developers pay only for what they use

VMM Implementation Overview A VMM is just an operating system that exposes a (virtual) hardware interface Windows virtual machine Linux virtual machine virtual architecture Virtual machines safely shared. Even if the system has one disk, we need the appearance of N virtual disks; N TLBs; N Processors; N Ethernet devices, etc. = virtual machine monitor physical architecture hardware

Comparing the Unix and VMM APIs Storage File system (virtual) disk Networking Sockets (virtual) Ethernet Memory Virtual Memory (virtual) Physical memory Display /dev/console (virtual) Keyboard, display device

Possible Implementation Strategy: Complete machine emulation The VMM implements the complete hardware architecture in software while(true) { Instruction instr = fetch(); // emulate behavior in software instr.emulate(); } Drawback: This is really slow

Review: Protection in Traditional OS’s Hardware exposes a user/kernel boundary Operating system runs in kernel mode Processes run in user mode Processes can safely execute most instructions No need to “emulate” machine behavior But, a small set of instructions can only execute in privileged mode e.g., writing to an I/O device, disabling interrupts, etc.

Improving VMM Performance Treat guest operating systems like an application Most instructions execute natively on the CPU Privileged instructions must be trapped and emulated Virtual machines Physical hardware loads,stores, branches, ALU operations Systems lore: make the common case fast, and the uncommon case correct machine halt, I/O instructions, MMU manipulation VMM

Handling Privileged Instruction Virtual machine issues a privileged instruction (e.g., disk read) VMM determines whether the virtual machine was in “user” mode or “kernel” mode Note: the virtual mode is distinct from the physical mode (Yikes!) If “user” mode, raise a protection exception If “kernel” mode, emulate the disk read in software; then, return control to the guest OS

Tracing Through a File System Read Application Guest OS VMM read() syscall trap handler handle read syscall read from disk() trap privileged instruction If “kernel” mode: emulate virtual disk else: raise protection violation finish read syscall copy data to user buffer return from system call return from read()

Virtual Disk: Possible Implementations Static disk partitions A file in the file system Especially for type-II VMMs A special virtual disk file system A network storage abstraction e.g., Amazon’s S3 Use the layer of indirection to provide new services. For example, we could provide cryptographic storage, even if the OS/ file system do not implement this behavior

Virtualizing the User/Kernel Boundary Both the guest OS and applications run in (physical) user-mode This is necessary so that privileged instructions trap into the VMM For each virtual machine, the VMM keeps a software mode bit: During a system call, switch to “kernel” mode On system call return, switch to “user” mode Note: A faster implementation is possible on x86

(Virtual) Physical Memory Each guest OS expects its own page tables, TLB, memory-management unit, etc. Unlike the virtual disk, we can’t trap and emulate every memory reference WAY too slow Additional complication: protection bits Some memory can only be accessed in “kernel” mode

Memory Model Virtual Memory (Applications) Increasing privilege Physical Memory (Guest OS) Machine Memory (VMM) Assume a software-loaded TLB: InsertTLB(int virtualPageNumber,int physPageNumber);

Virtual Physical Memory, Implementation (Bad) Option #1: Insert the V-to-P mapping directly into the TLB; Trap each memory access to return the V-to-M memory Better Option #2: Instead of inserting a V-to-P mapping, transparently insert a V-to-M mapping This way, all future memory references will occur at hardware speed

Performance Details TLB must be flushed on a process switch and a virtual machine switch Whenever a virtual machine regains the processor, it requires numerous page faults to restore its virtual memory mappings Optimization: VMM maintains a cache of V-to-M mappings for each virtual machine On taking a page fault, the VMM can insert the appropriate TLB mapping without consulting the guest OS