Spring 2017 :: CSE 506. Introduction to. Virtual Machines. Nima Honarmand

Similar documents
Module 1: Virtualization. Types of Interfaces

Chapter 5 C. Virtual machines

Virtual Machines. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

Virtualization. Starting Point: A Physical Machine. What is a Virtual Machine? Virtualization Properties. Types of Virtualization

Virtualization. ! Physical Hardware Processors, memory, chipset, I/O devices, etc. Resources often grossly underutilized

Virtualization. Pradipta De

CS370 Operating Systems

What is KVM? KVM patch. Modern hypervisors must do many things that are already done by OSs Scheduler, Memory management, I/O stacks

The Challenges of X86 Hardware Virtualization. GCC- Virtualization: Rajeev Wankar 36

Virtualization. Operating Systems, 2016, Meni Adler, Danny Hendler & Amnon Meisels

references Virtualization services Topics Virtualization

Virtualization. ...or how adding another layer of abstraction is changing the world. CIS 399: Unix Skills University of Pennsylvania.

Virtual Machines. Part 2: starting 19 years ago. Operating Systems In Depth IX 1 Copyright 2018 Thomas W. Doeppner. All rights reserved.

Distributed Systems COMP 212. Lecture 18 Othon Michail

Lecture 5: February 3

The Architecture of Virtual Machines Lecture for the Embedded Systems Course CSD, University of Crete (April 29, 2014)

CSE 120 Principles of Operating Systems

Multiprocessor Scheduling. Multiprocessor Scheduling

CHAPTER 16 - VIRTUAL MACHINES

Operating Systems 4/27/2015

Introduction to Virtual Machines. Carl Waldspurger (SB SM 89 PhD 95) VMware R&D

CS 550 Operating Systems Spring Introduction to Virtual Machines

CS 470 Spring Virtualization and Cloud Computing. Mike Lam, Professor. Content taken from the following:

OS Virtualization. Why Virtualize? Introduction. Virtualization Basics 12/10/2012. Motivation. Types of Virtualization.

I/O and virtualization

Virtualisation: The KVM Way. Amit Shah

Nested Virtualization and Server Consolidation

Advanced Operating Systems (CS 202) Virtualization

Virtualization. Michael Tsai 2018/4/16

COS 318: Operating Systems. Virtual Machine Monitors

Virtual Machine Monitors!

CS 350 Winter 2011 Current Topics: Virtual Machines + Solid State Drives

Overview of System Virtualization: The most powerful platform for program analysis and system security. Zhiqiang Lin

CSC 5930/9010 Cloud S & P: Virtualization

1 Virtualization Recap

COMPUTER ARCHITECTURE. Virtualization and Memory Hierarchy

Introduction to Cloud Computing and Virtualization. Mayank Mishra Sujesha Sudevalayam PhD Students CSE, IIT Bombay

System Virtual Machines

CprE Virtualization. Dr. Yong Guan. Department of Electrical and Computer Engineering & Information Assurance Center Iowa State University

CS370 Operating Systems

CHAPTER 16 - VIRTUAL MACHINES

Virtual Machines. To do. q VM over time q Implementation methods q Hardware features supporting VM q Next time: Midterm?

Lecture 7. Xen and the Art of Virtualization. Paul Braham, Boris Dragovic, Keir Fraser et al. 16 November, Advanced Operating Systems

LINUX Virtualization. Running other code under LINUX

Virtual Machine Monitors (VMMs) are a hot topic in

The only open-source type-1 hypervisor

Virtualization. Virtualization

CS370: Operating Systems [Spring 2017] Dept. Of Computer Science, Colorado State University

NON SCHOLAE, SED VITAE

Optimizing and Enhancing VM for the Cloud Computing Era. 20 November 2009 Jun Nakajima, Sheng Yang, and Eddie Dong

Learning Outcomes. Extended OS. Observations Operating systems provide well defined interfaces. Virtual Machines. Interface Levels

VIRTUALIZATION: IBM VM/370 AND XEN

Virtualization (II) SPD Course 17/03/2010 Massimo Coppola

Virtualization. join, aggregation, concatenation, array, N 1 ühendamine, agregeerimine, konkateneerimine, massiiv

Virtual Virtual Memory

Virtualization. Dr. Yingwu Zhu

CS-580K/480K Advanced Topics in Cloud Computing. VM Virtualization II

Virtual Machine Security

Hypervisor security. Evgeny Yakovlev, DEFCON NN, 2017

DISCO and Virtualization

for Kerrighed? February 1 st 2008 Kerrighed Summit, Paris Erich Focht NEC

Micro VMMs and Nested Virtualization

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

Course Review. Hui Lu

System Virtual Machines

EE 660: Computer Architecture Cloud Architecture: Virtualization

Virtualization and memory hierarchy

Virtualization. Adam Belay

Background. IBM sold expensive mainframes to large organizations. Monitor sits between one or more OSes and HW

CS370: Operating Systems [Spring 2016] Dept. Of Computer Science, Colorado State University

CS370: Operating Systems [Spring 2017] Dept. Of Computer Science, Colorado State University

Lecture 09: VMs and VCS head in the clouds

24-vm.txt Mon Nov 21 22:13: Notes on Virtual Machines , Fall 2011 Carnegie Mellon University Randal E. Bryant.

Knut Omang Ifi/Oracle 6 Nov, 2017

How it can help your organisation

Introduction Construction State of the Art. Virtualization. Bernhard Kauer OS Group TU Dresden Dresden,

Virtualization. Guillaume Urvoy-Keller UNS/I3S

Xen and the Art of Virtualization

We ve seen lots of examples of virtualization. This is another: a virtual machine monitor. A VMM virtualizes an entire hardware machine.

Server Virtualization Approaches

Lecture 5. KVM for ARM. Christoffer Dall and Jason Nieh. 5 November, Operating Systems Practical. OSP Lecture 5, KVM for ARM 1/42

CSCI 8530 Advanced Operating Systems. Part 19 Virtualization

Virtual Leverage: Server Consolidation in Open Source Environments. Margaret Lewis Commercial Software Strategist AMD

Virtual Machines Disco and Xen (Lecture 10, cs262a) Ion Stoica & Ali Ghodsi UC Berkeley February 26, 2018

Virtualization Introduction


Cloud and Datacenter Networking

Testing System Virtual Machines

Knut Omang Ifi/Oracle 20 Oct, Introduction to virtualization (Virtual machines) Aspects of network virtualization:

Networks and Opera/ng Systems Chapter 21: Virtual Machine Monitors ( )

Xen and the Art of Virtualization

SUSE An introduction...

A Survey on Virtualization Technologies

An overview of virtual machine architecture

SUSE Linux Enterprise Server: Supported Virtualization Technologies

Virtual Pc Manual Windows 7 64 Bit Guest On 32-bit Host

CS370 Operating Systems

Cloud Computing Virtualization

Container Adoption for NFV Challenges & Opportunities. Sriram Natarajan, T-Labs Silicon Valley Innovation Center

VIRTUALIZATION. Dresden, 2011/12/6. Julian Stecklina

Transcription:

Introduction to Virtual Machines Nima Honarmand

Virtual Machines & Hypervisors Virtual Machine: an abstraction of a complete compute environment through the combined virtualization of the processor, memory, and I/O components of a computer. Hypervisor: system software that manages and runs virtual machines Think of an OS sitting below virtual machines VM 1 Guest Apps Guest OS Virtual Hardware Hypervisor Physical Hardware VM n Guest Apps Guest OS Virtual Hardware

Type-1 & 2 Hypervisors Type 1 (bare-metal) Type 2 (hosted) VM1 VM2 Guest Guest VM1 VM2 Hypervisor user-mode Host Hypervisor Hardware Hosting OS Hardware Hypervisor Driver Host VMware ESX, Microsoft Hyper-V, Xen, Qemu VMware Workstation, Microsoft Virtual PC, Sun VirtualBox, QEMU, KVM Type-1: hypervisor controls the bare metal mostly servers Type-2: hypervisor is hosted inside a host OS mostly desktops

VM Use-cases (1) 1) Server consolidation: physical servers are often underutilized in data centers Consolidate multiple virtual servers on a single physical server to improve utilization Has numerous cost benefits: reduces hardware cost, electricity bills, maintenance overhead, deployment costs, etc. Enables better fault tolerant: if a physical machine (or part of it) fails, move the VM image to a new machine Improves service availability Could be even done without shutting the VM down (live migration)

VM Use-cases (2) 2) Transparently adding services below operating systems (w/o OS or application modifications) Encrypted storage Logging of OS activities to provide time travel (e.g., rollback the state) or replay features Live migration 3) Software testing and development Test your code on many different platforms, even ones that are not physically available Developing system software on virtual platforms is much easier than physical ones You re doing something similar with JOS

VM Use-cases (3) 4) Desktop virtualization Simultaneously have multiple OSes on your desktop to use their native apps 5) Support multiple users with larger isolation Compared to sharing the same OS between multiple users Each user can customize their OS the way they like 6) What else can you think of?

High-Level Requirements Security and Isolation Hypervisor should be in complete control of the machine VMs should be protected from each other Hypervisor should be protected from VMs Performance VM performance should be close to native (non-virtualized) execution Means most VM instructions (both OS and apps) should execute directly on the processor Sounds familiar? We said the same things when discussing kernel vs. application requirements (hypervisor kernel, guest application)

Problem with VMs What is special about the VMs then? Abstraction OS was free to choose the resource abstraction it exposed to applications High-level, easy-to-provide abstractions such as threads, files and sockets instead of processors, disks, interrupts, I/O devices, etc. VMs are an after-thought; Guest OS has already been written assuming a particular hardware model Low-level CPU and MMU details are hard-coded in the OS Same for I/O devices Hypervisor has to provide the abstraction expected by guest OS (or something very close)

Approach #1: Full Virtualization Hardware exposed to guest mimics a real hardware configuration No change required to the guest OS Does not have to be exactly the same as underlying machine E.g., can have smaller memory, fewer processor cores, different I/O devices, etc. But should look and feel like some real machine

Problems w/ Full Virtualization To protect hypervisor, guest kernel may not run in privileged mode Idea: let s run the whole guest (both kernel and user) in unprivileged mode But any kernel will have to perform privileged operations; what we should do about them? Idea: Trap-and-Emulate CPU will fault when guest OS tries to execute a privileged operation Hypervisor then takes over, decodes the operation and emulates its effect Examples: a system call on the guest OS

Problems w/ Full Virtualization Two problems with trap-and-emulate: 1) Too many traps will cause severe performance degradation 2) Not all sensitive instructions will generate traps in all architectures Example: SIDT and POPF in x86 Guest OS (running in Ring 3) can read, and be confused by, privileged state belonging to hypervisor A solution to (2): Binary translation The hypervisor will analyze all of guest code, and replace non-trapping sensitive instructions w/ explicit traps This idea gave birth to VMware, enabling it to virtualize x86 efficiently

Approach #2: Para-virtualization Expose a different, virtualization-friendly abstraction to the guest OS Will require changes to the guest OS (hopefully not so big) Xen reported 1.5% code change for Linux and 0.04% for Windows XP Guest OS knows that it is being virtualized and run w/ reduced privilege It is careful w/ unprivileged sensitive operations It avoids most trap-and-emulate situations by using explicit hypercalls to the hypervisor

What to Virtualize? Three things: 1) CPU (everything, including the privileged state) 2) Memory Management Unit (MMU) 3) I/O Devices (1) and (3) are simpler Just trap on relevant accesses, or binary translate them, or have the guest OS make hypercalls (2) is more complicated It requires shadow page tables in absence of virtualization-hardware support

MMU Virtualization Problem We deal with three types of memory spaces in a virtualized environment Guest Virtual Guest Physical Host Physical Need one page table from GV to GP and another from GP to HP Guest Page Table But (older) processors MMUs can only deal with one page table Host Page Table Guest Virtual Guest Physical Host Physical

Shadow Page Tables For each (GV GP HP) need to combine the two translations into a single translation kept in a shadow page table For this, the hypervisor needs to know of any change to the guest page table I.e., GV GP translation Full virtualization: mark guest page table pages read only trap on every page table change Guest Virtual Guest Physical Host Physical Shadow Page Table GV HP Para-virtualization: make a hypercall to the hypervisor to change the shadow page table

Approach #3: Hardware-Assisted Virtualization Trap-and-emulate is expensive Too many changes to guest (for para-virt) not always desirable Change hardware to make it virtualization friendly E.g., Intel VT-x and AMD-V technologies Hardware support to eliminate most trap-and-emulate situations CPU: duplicate the entire architecturally visible state of the processor in separate root (for the hypervisor) and non-root (for guests) modes Makes most traps into hypervisor unnecessary MMU: HW supports second layer of page table (managed by hypervisor) Makes shadow page tables unnecessary I/O: add support for high-performance I/O through IOMMU and SR-IOV Enables direct hardware access by guests State of the art Will discuss extensively in the student presentations

Lightweight Virtualization Also known as containers Examples: Docker, OpenVZ, Linux Containers (LXC) All processes on the machine share the same kernel Each container will use a different user-mode image of a compatible OS For example, different Linux distributions (as long as they work w/ underlying kernel) Each container typically has a different root directory Recall per-process roots in VFS lecture Not real virtualization; just different user-mode OS images sharing the same HW & kernel Host OS Processes (Ubuntu 17.04) root=/ PID 1 PID 10 Container 1 Processes (Ubuntu X) root=/disk/containers/xx PID 2 PID 35 PID 57 Linux Kernel 4.10 Container 2 Processes (CentOS Y) root=/disk/containers/yy PID 46 PID 65 PID 8