COS 318: Operating Systems. Virtual Machine Monitors

Similar documents
COS 318: Operating Systems. Virtual Machine Monitors

Virtual Machine Monitors. Dr. Marc E. Fiuczynski Research Scholar Princeton University

COS 318: Operating Systems. Virtual Machine Monitors

Virtualization. Dr. Yingwu Zhu

Full and Para Virtualization

Virtualization. Explain how today s virtualization movement is actually a reinvention

Virtualization. Types of Interfaces

Virtualization Technology. Zhiming Shen

Uses for Virtual Machines. Virtual Machines. There are several uses for virtual machines:

Virtualization. Pradipta De

Virtual Machines. COMP 3361: Operating Systems I Winter

Virtualization. Jia Rao Assistant Professor in CS

Microkernels, virtualization, exokernels. Tutorial 1 CSC469

Hypervisors. Introduction. Introduction. Introduction. Introduction. Introduction. Credits:

Cloud Computing #6 - Virtualization

Introduction to Virtual Machines

Virtualization. Jukka K. Nurminen

Virtual machines and operating systems

OS Virtualization. CSC 456 Final Presentation Brandon D. Shroyer

Virtualization for Cloud Computing

CS 695 Topics in Virtualization and Cloud Computing. More Introduction + Processor Virtualization

Virtualization. ! Physical Hardware. ! Software. ! Isolation. ! Software Abstraction. ! Encapsulation. ! Virtualization Layer. !

Virtual Machines. Virtualization

nanohub.org An Overview of Virtualization Techniques

The Xen of Virtualization

Basics of Virtualisation

An Introduction to Virtual Machines Implementation and Applications

Distributed and Cloud Computing

Hypervisors and Virtual Machines

COM 444 Cloud Computing

MODULE 3 VIRTUALIZED DATA CENTER COMPUTE

Chapter 5 Cloud Resource Virtualization

Cloud Computing CS

Clouds Under the Covers. Elgazzar - CISC Fall

Virtualization and the U2 Databases

Distributed Systems. Virtualization. Paul Krzyzanowski

Xen and the Art of. Virtualization. Ian Pratt

Basics in Energy Information (& Communication) Systems Virtualization / Virtual Machines

VMware and CPU Virtualization Technology. Jack Lo Sr. Director, R&D

Virtualization Technologies

Xen and the Art of Virtualization

Models For Modeling and Measuring the Performance of a Xen Virtual Server

Virtualization Technologies (ENCS 691K Chapter 3)

Chapter 2 Addendum (More on Virtualization)

Anh Quach, Matthew Rajman, Bienvenido Rodriguez, Brian Rodriguez, Michael Roefs, Ahmed Shaikh

Chapter 16: Virtual Machines. Operating System Concepts 9 th Edition

Intel s Virtualization Extensions (VT-x) So you want to build a hypervisor?

Memory Resource Management in VMware ESX Server

Virtual Machines.

CPET 581 Cloud Computing: Technologies and Enterprise IT Strategies. Virtualization of Clusters and Data Centers

IOS110. Virtualization 5/27/2014 1

System Virtual Machines

Understanding Full Virtualization, Paravirtualization, and Hardware Assist. Introduction...1 Overview of x86 Virtualization...2 CPU Virtualization...

Knut Omang Ifi/Oracle 19 Oct, 2015

Virtualization VMware Inc. All rights reserved

Outline. Outline. Why virtualization? Why not virtualize? Today s data center. Cloud computing. Virtual resource pool

Regional SEE-GRID-SCI Training for Site Administrators Institute of Physics Belgrade March 5-6, 2009

KVM: A Hypervisor for All Seasons. Avi Kivity avi@qumranet.com

Chapter 14 Virtual Machines

Networking for Caribbean Development

Cloud Computing. Dipl.-Wirt.-Inform. Robert Neumann

VMware Server 2.0 Essentials. Virtualization Deployment and Management

Enabling Technologies for Distributed Computing

Cloud^H^H^H^H^H Virtualization Technology. Andrew Jones May 2011

Development of Type-2 Hypervisor for MIPS64 Based Systems

Hardware Based Virtualization Technologies. Elsie Wahlig Platform Software Architect

x86 ISA Modifications to support Virtual Machines

Virtualization Technologies and Blackboard: The Future of Blackboard Software on Multi-Core Technologies

Virtualization. P. A. Wilsey. The text highlighted in green in these slides contain external hyperlinks. 1 / 16

VMkit A lightweight hypervisor library for Barrelfish

Virtualization. P. A. Wilsey. The text highlighted in green in these slides contain external hyperlinks. 1 / 16

Enabling Technologies for Distributed and Cloud Computing

Hybrid Virtualization The Next Generation of XenLinux

Virtual Computing and VMWare. Module 4

kvm: Kernel-based Virtual Machine for Linux

Analysis on Virtualization Technologies in Cloud

OS Virtualization Frank Hofmann

Survey On Hypervisors

Data Centers and Cloud Computing

Nested Virtualization

ARM Virtualization: CPU & MMU Issues

Virtualization. Introduction to Virtualization Virtual Appliances Benefits to Virtualization Example Virtualization Products

x86 Virtualization Hardware Support Pla$orm Virtualiza.on

The Art of Virtualization with Free Software

How do Users and Processes interact with the Operating System? Services for Processes. OS Structure with Services. Services for the OS Itself

12. Introduction to Virtual Machines

Virtualization. Michael Tsai 2015/06/08

Introduction to Virtual Machines

Virtualization Concepts And Applications. Yash Jain DA-IICT (DCOM Research Group)

CS 695 Topics in Virtualization and Cloud Computing. Introduction

WHITE PAPER Mainstreaming Server Virtualization: The Intel Approach

Virtual Machines Fact Sheet

Satish Mohan. Head Engineering. AMD Developer Conference, Bangalore

Optimizing Network Virtualization in Xen

The future is in the management tools. Profoss 22/01/2008

MIT IAP Course Lecture #1: Virtualization 101

Virtualization Technology. Zhonghong Ou Data Communications Software Lab, Aalto University

INFO5010 Advanced Topics in IT: Cloud Computing

Gavin Payne Senior Consultant.

A Survey on Virtualization Technologies

Transcription:

COS 318: Operating Systems Virtual Machine Monitors Jaswinder Pal Singh Computer Science Department Princeton University http://www.cs.princeton.edu/courses/archive/fall13/cos318/

Virtual Machine Monitor (VMM) u Sits between multiples OSes and hardware (or a host OS) u Presents a hardware interface to the OSes above u Gives the illusion to each OS above that it controls the whole machine l Actually, the VMM does, and each OS sees a virtual machine l The VMs (and OSes) share the actual hardware resources u Manages (multiplexes) resources among several virtual machines (VMs) u Isolates VMs from each other u Similar to what an OS does: abstraction, resource mgmt u a.k.a. Hypervisor 2

History u Have been around since 1960 s on mainframes l Used to run apps on different OSes on same (very expensive ) mainframe l Good example VM/370 u Computers became cheaper, people lost interest u Have resurfaced on commodity platforms l Server Consolidation: save space and power Web Hosting centers l High-Performance Compute Clusters: run different OSes l Managed desktop / thin-client Save desktop in a VM and bring it with you on a USB drive l Software development / kernel hacking 3

Goals u Manageability l Creation, maintenance, administration, provisioning, etc. u Performance l Overhead of virtualization should be small u Isolation l Activity of one VM should not impact other active VMs l Data of one VM is inaccessible by another u Scalability l Minimize cost per VM Same goals as for many susbystems 4

VMM Types 5

Virtualization Styles u Fully virtualizing VMM l Virtual machine looks exactly like a (some) physical machine Not necessarily exactly like the underlying hardware itself l Run guest OS unchanged l VMM is transparent to the OS u Para- virtualizing VMM l Guest OS is changed to cooperate with VMM l Sacrifice transparency for better performance l E.g. VMM can provide idealized view of hardware l E.g. VMM can provide hypervisor API so guest can perform certain functions 6

VMM Classification Type I Type II Fully-virtualized VMware ESX VMware Workstation. VIrtualBox, Virtual PC Para-virtualized Xen User Mode Linux 7

VMM Implementation Should efficiently virtualize the hardware u Provide illusion of multiple machines u Retain control of the physical machine Subsystems u Processor Virtualization u I/O virtualization u Memory Virtualization 8

Processor Virtualization Popek and Goldberg (1974) l Sensitive instructions: only executed in kernel mode l Privileged instructions: trap when run in user mode l CPU architecture is virtualizable only if sensitive instructions are subset of privileged instructions i.e. sensitive instructions will always trap if run in user mode l When guest OS, which runs in user mode, runs a sensitive instruction, must trap to VMM so it maintains control 9

Example: System Call (Type 1 Hypervisor) Process Operating System VMM 1.System call: Trap to OS 5. Resume execution (@PC after trap) 3. OS trap handler: Decode trap and execute syscall; When done: issue returnfrrom-trap 2. Process trapped: call OS trap handler (at reduced privilege) 4. OS tried to return from trap; do real return-from-trap 10

x86 Processor Virtualization u x86 architecture is not fully virtualizable l Certain privileged instructions behave differently when run in unprivileged mode, e.g. do nothing (e.g. POPF) l Certain unprivileged instructions can access privileged state (so guest OS would be able to see that it s not running in kernel mode) u Techniques to address inability to virtualize x86 l Replace non-virtualizable instructions with easily virtualized ones statically (Paravirtualization) l Perform Binary Translation (Full Virtualization) l Note: both basically remove problematic (nonvirtualizable) instructions from the guest OS 11

I/O Virtualization u Issue: lots of I/O devices u Problem: Writing device drivers for all I/O device in the VMM layer is not a feasible option u Insight: Device driver already written for popular Operating Systems u One Solution: l Present virtual I/O devices to guest VMs l Channel I/O requests to a trusted host VM running a popular OS that has the device drivers 12

I/O Virtualization VMM VMM + Device Drivers (a) Virtual DD, channel to guest OS - e.g. Xen (b) Integrate DD with VMM - e.g. Vmware ESX (Linux DDs) 13

Memory Virtualization u Traditional way is to have the VMM maintain a shadow of the VM s page table u The shadow page keeps mapping from virtual pages within a VM to real physical pages u When VM tries to change MMU to point to a specific page table, this traps to VMM which updates MMU to point to the shadow page table l Shadow PT has actual mappings between virtual pages in VM and real physical pages in machine u Keeping shadow page table in sync with guest PT: l When guest OS updates page table, VMM updates shadow l E.g. pages of guest OS page table marked read-only 14

Case Study: VMware ESX Server u Type I VMM - Runs on bare hardware u Full-virtualized Legacy OS can run unmodified on top of ESX server u Fully controls hardware resources and provides good performance 15

ESX Server CPU Virtualization u Most user code executes in Direct Execution mode; near native performance u For kernel code, uses runtime Binary Translation for x86 virtualization l Privileged mode code is run under control of a Binary Translator, which emulates problematic instructions l Fast compared to other binary translators as source and destination instruction sets are nearly identical 16

ESX Server Memory Virtualization u Maintains shadow page tables with virtual to machine address mappings. u Shadow page tables are used by the physical processor u ESX maintains a pmap data structure for each VM, which holds physical to machine address mappings u Shadow page tables are kept consistent with pmap u With pmap, ESX can easily remap a physical to machine page mapping, without guest VM knowing the difference 17

ESX Server Memory Mgmt u Page reclamation l Problem: VMM does not have as good information on page usage as guest OS, for actual page replacement algorithms l Solution: Ballooning technique Reclaims memory from other VMs when memory is overcommitted u Page sharing l Many VMs will use the same pages l Solution: Content based sharing l Eliminates redundancy and saves memory pages when VMs use same operating system and applications 18

ESX Server- Ballooning 19

ESX Server Page Sharing Copy-on-write for writing shared pages 20

Real World Page Sharing 21

ESX Server I/O Virtualization u Has highly optimized storage subsystem for networking and storage devices l Directly integrated into the VMM l Uses device drivers from the Linux kernel to talk directly to the device u Low performance devices are channeled to special host VM, which runs a full Linux OS VMM + Device Drivers VMM 22

VMware Workstation u Type II VMM - Runs on host operating system u Full-virtualized Legacy OS can run unmodified on top of VMware Workstation u Appears like a process to the Host OS 23

Workstation - Virtualization u CPU Virtualization and Memory Virtualization l Uses Similar Techniques as the VMware ESX server u I/O Virtualization l Workstation relies on the Host OS for satisfying I/O requests l I/O incurs huge overhead as it has to switch to the Host OS on every IN/OUT instruction. l E.g., Virtual disk maps to a file in Host OS 24

Workstation Virtualize NIC 25

Xen u Type I VMM u Para-virtualized u Open-source u Designed to run about 100 virtual machines on a single machine 26

Xen CPU Virtualization u Privileged instructions are para-virtualized by requiring them to be validated and executed with Xen u Processor Rings l Guest applications run in Ring 3 l Guest OS runs in Ring 1 (not ring 0 as without virtualization) l Xen runs in Ring 0 l So if guest OS executes privileged instruction, it traps to Xen 27

Xen Memory Virtualization(1) u Initial memory allocation is specified and memory is statically partitioned u A maximum allowable reservation is also specified. u Balloon driver technique similar to ESX server used to reclaim pages 28

Xen Memory Virtualization(2) u Guest OS is responsible for allocating and managing hardware page table u Xen involvement is limited to ensure safety and isolation u OS maps Xen VMM into the top 64 MB section of every address space to avoid TLB flushes when entering and leaving the VMM 29

Xen I/O Virtualization u Xen exposes its own set of clean and simple device abstractions doesn t emulate existing devices u I/O data is transferred to and from each domain via Xen, using shared memory, asynchronous buffer descriptor rings u Xen supports lightweight event delivery mechanism used for sending asynchronous notifications to domains 30

Summary u Classifying Virtual Machine Monitors l Type I vs. type II l Full vs. para-virtualization u Processor virtualization u Memory virtualization u I/O virtualization 31