CHAPTER 16 - VIRTUAL MACHINES

Similar documents
CHAPTER 16 - VIRTUAL MACHINES

Chapter 5 C. Virtual machines

CS370 Operating Systems

CS370 Operating Systems

Unit 5: Distributed, Real-Time, and Multimedia Systems

Virtual Machines. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

Module 1: Virtualization. Types of Interfaces

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

CSE 120 Principles of Operating Systems

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

Lecture 5: February 3

COMPUTER ARCHITECTURE. Virtualization and Memory Hierarchy

Virtualization. Pradipta De

Operating Systems 4/27/2015

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

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

Using MySQL in a Virtualized Environment. Scott Seighman Systems Engineer Sun Microsystems

Virtualization and memory hierarchy

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

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

Multiprocessor Scheduling. Multiprocessor Scheduling

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

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

Nested Virtualization and Server Consolidation

Distributed Systems COMP 212. Lecture 18 Othon Michail

Virtual Machine Monitors (VMMs) are a hot topic in

LINUX Virtualization. Running other code under LINUX

CSCI 8530 Advanced Operating Systems. Part 19 Virtualization

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

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

Virtualization. Dr. Yingwu Zhu

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

Virtualization. Michael Tsai 2018/4/16

Originally prepared by Lehigh graduate Greg Bosch; last modified April 2016 by B. Davison

COS 318: Operating Systems. Virtual Machine Monitors

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

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

references Virtualization services Topics Virtualization

CSC 5930/9010 Cloud S & P: Virtualization

Virtual Machine Monitors!

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

Server Virtualization Approaches

SUSE Linux Enterprise Server: Supported Virtualization Technologies

Chapter 2: Operating-System Structures

CLOUD COMPUTING IT0530. G.JEYA BHARATHI Asst.Prof.(O.G) Department of IT SRM University

System Virtual Machines

Last class: OS and Architecture. OS and Computer Architecture

Last class: OS and Architecture. Chapter 3: Operating-System Structures. OS and Computer Architecture. Common System Components

Oracle-Regular Oracle-Regular

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

Virtualization Introduction

EE 660: Computer Architecture Cloud Architecture: Virtualization

VIRTUALIZATION: IBM VM/370 AND XEN

Four Components of a Computer System

Linux and Xen. Andrea Sarro. andrea.sarro(at)quadrics.it. Linux Kernel Hacking Free Course IV Edition

Full file at

Xen and the Art of Virtualization. CSE-291 (Cloud Computing) Fall 2016

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

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

SWsoft ADVANCED VIRTUALIZATION AND WORKLOAD MANAGEMENT ON ITANIUM 2-BASED SERVERS

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

Virtual Memory. Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University

OPERATING SYSTEMS UNIT - 1

The only open-source type-1 hypervisor

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

Advanced Operating Systems (CS 202) Virtualization

CSCE 410/611: Virtualization

Virtual Machine Security

An overview of virtual machine architecture

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

DISCO and Virtualization

NON SCHOLAE, SED VITAE

Operating System: Chap2 OS Structure. National Tsing-Hua University 2016, Fall Semester

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

System Virtual Machines

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

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

OS and Computer Architecture. Chapter 3: Operating-System Structures. Common System Components. Process Management

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

Performance & Scalability Testing in Virtual Environment Hemant Gaidhani, Senior Technical Marketing Manager, VMware

What is a VM? Categories of Virtual Machines. Process Virtual Machine 11/17/2010

Chapter 2: Operating-System Structures. Operating System Concepts Essentials 8 th Edition

Virtualization. Virtualization

Chapter 2: Operating-System

CSE543 - Computer and Network Security Module: Virtualization

Cloud Computing Virtualization

OPS-9: Fun With Virtualization. John Harlow. John Harlow. About John Harlow

Parallels Virtuozzo Containers

Cloud and Datacenter Networking

Xen and the Art of Virtualization. Nikola Gvozdiev Georgian Mihaila

I/O and virtualization

CSCE 410/611: Virtualization!

Virtualization, Xen and Denali

Types of Virtualization. Types of virtualization

What is Cloud Computing? Cloud computing is the dynamic delivery of IT resources and capabilities as a Service over the Internet.

Deploying Application and OS Virtualization Together: Citrix and Virtuozzo

CHAPTER 1 - INTRODUCTION. Jacob Aae Mikk elsen

CS 550 Operating Systems Spring Operating Systems Overview

Chapter 2: Operating-System Structures

Transcription:

CHAPTER 16 - VIRTUAL MACHINES 1

OBJECTIVES Explore history and bene ts of virtual machines. Discuss the various virtual machine technologies. Describe the methods used to implement virtualization. Show the most common hardware features that support virtualization and explain how they are used by operating-system modules. Containerization

OVERVIEW 3. 12

OVERVIEW Fundamental idea abstract hardware of a single computer into several different execution environments Similar to layered approach But layer creates virtual system (virtual machine, or VM) on which operation systems or applications can run 3. 2

COMPONENTS Host underlying hardware system Virtual machine manager (VMM) or hypervisor creates and runs virtual machines by providing interface that is identical to the host (Except in the case of paravirtualization) Guest process provided with virtual copy of the host Usually an operating system Single physical machine can run multiple operating systems concurrently, each in its own virtual machine

SYSTEM MODELS 3. 3

IMPLEMENTATION OF VMMS Vary greatly, with options including: Type 0 hypervisors - Hardware-based solutions that provide support for virtual machine creation and management via rmware IBM LPARs and Oracle LDOMs are examples 3. 45

IMPLEMENTATION OF VMMS Type 1 hypervisors - Operating-system-like software built to provide virtualization Including VMware ESX, Joyent SmartOS, and Citrix XenServer Type 1 hypervisors Also includes general-purpose operating systems that provide standard functions as well as VMM functions Including Microsoft Windows Server with HyperV and RedHat Linux with KVM

IMPLEMENTATION OF VMMS Type 2 hypervisors - Applications that run on standard operating systems but provide VMM features to guest operating systems Including VMware Workstation and Fusion, Parallels Desktop, and Oracle VirtualBox 3. 67

OTHER VARIATIONS Paravirtualization - Technique in which the guest operating system is modi ed to work in cooperation with the VMM to optimize performance Programming-environment virtualization - VMMs do not virtualize real hardware but instead create an optimized virtual system Used by Oracle Java and Microsoft.Net

OTHER VARIATIONS Emulators Allow applications written for one hardware environment to run on a very different hardware environment, such as a different type of CPU Application containment - Not virtualization at all but rather provides virtualization-like features by segregating applications from the operating system, making them more secure, manageable Including Oracle Solaris Zones, BSD Jails, and IBM AIX WPARs 3. 8

HISTORY 34. 91

HISTORY First appeared in IBM mainframes in 1972 Allowed multiple users to share a batch-oriented system IBM VM 370 divided a mainframe into multiple virtual machines, each running its own OS 4. 2

HISTORY Formal de nition of virtualization helped move it beyond IBM 1. A VMM provides an environment for programs that is essentially identical to the original machine 2. Programs running within that environment show only minor performance decreases 3. The VMM is in complete control of system resources

HISTORY In late 1990s Intel CPUs fast enough for researchers to try virtualizing on general purpose PCs Xen and VMware created technologies, still used today Virtualization has expanded to many OSes, CPUs, VMMs Even more important with containerization 4. 3

BENEFITS AND FEATURES 45. 41

BENEFITS AND FEATURES fundamentally related to the ability to share the same hardware yet run several different execution environments (i.e. different OS s) concurrently. 5. 2

BENEFITS AND FEATURES Host system protected from VMs, VMs protected from each other I.e. A virus less likely to spread Sharing is provided though via shared le system volume, network communication Freeze, suspend, running VM Then can move or copy somewhere else and resume

BENEFITS AND FEATURES Snapshot of a given state, able to restore back to that state Some VMMs allow multiple snapshots per VM Clone by creating copy and running both original and copy Great for OS research Better system development ef ciency 5. 3

BENEFITS AND FEATURES Templating create an OS + application VM, provide it to customers, use it to create multiple instances of that combination Live migration move a running VM from one host to another! No interruption of user access All those features taken together cloud computing Using APIs, programs tell cloud infrastructure (servers, networking, storage) to create new guests, VMs, virtual desktops 5. 4

BUILDING BLOCKS 56. 51

BUILDING BLOCKS Generally dif cult to provide an exact duplicate of underlying machine Especially if only dual-mode operation available on CPU But getting easier over time as CPU features and support for VMM improves Most VMMs implement virtual CPU (VCPU) to represent state of CPU per guest as guest believes it to be When guest context switched onto CPU by VMM, information from VCPU loaded and stored Several techniques, as described in next slides

TRAP AND EMULATE Dual mode CPU means guest executes in user mode Kernel runs in kernel mode Not safe to let guest kernel run in kernel mode too So VM needs two modes virtual user mode and virtual kernel mode Both of which run in real user mode Actions in guest that usually cause switch to kernel mode must cause switch to virtual kernel mode 6. 2

TRAP AND EMULATE How does switch from virtual user mode to virtual kernel mode occur? Attempting a privileged instruction in user mode causes an error trap VMM gains control, analyzes error, executes operation as attempted by guest Returns control to guest in user mode Known as trap-and-emulate Most virtualization products use this at least in part 6. 3

TRAP AND EMULATE User mode code in guest runs at same speed as if not a guest But kernel mode privilege mode code runs slower due to trap-and-emulate Especially a problem when multiple guests running, each needing trapand-emulate CPUs adding hardware support, mode CPU modes to improve virtualization performance 6. 4

TRAP-AND-EMULATE 6. 5

BINARY TRANSLATION Some CPUs don t have clean separation between privileged and nonprivileged instructions Earlier Intel x86 CPUs are among them Earliest Intel CPU designed for a calculator Backward compatibility means dif cult to improve 6. 6

BINARY TRANSLATION Consider Intel x86 popf instruction Loads CPU ags register from contents of the stack If CPU in privileged mode all ags replaced If CPU in user mode only some ags replaced No trap is generated in user mode 6. 7

BINARY TRANSLATION Other similar problem instructions we will call special instructions Caused trap-and-emulate method considered impossible until 1998 Binary translation solves the problem Basics are simple, but implementation very complex 6. 89

BINARY TRANSLATION If guest VCPU in user mode run instructions natively If guest VCPU in kernel mode (believes is in kernel mode) VMM examines every instruction guest is about to execute by reading a few instructions ahead of program counter Non-special-instructions run natively Special instructions translated into new set of instructions that perform equivalent task for example changing the ags in the VCPU

BINARY TRANSLATION VIRTUALIZATION IMPLEMENTATION 6. 10

BINARY TRANSLATION Implemented by translation of code within VMM Code reads native instructions dynamically from guest, on demand, generates native binary code that executes in place of original code Performance of this method would be poor without optimizations 6. 11 12

BINARY TRANSLATION Products like VMware use caching Translate once, and when guest executes code containing special instruction cached translation used instead of translating again Testing showed booting Windows XP as guest caused 950,000 translations, at 3 microseconds each, or 3 second (5%) slowdown over native

NESTED PAGE TABLES Memory management another general challenge to VMM implementations How can VMM keep page-table state for both guests believing they control the page tables and VMM that does control the tables? Common method (for trap-and-emulate and binary translation) is nested page tables (NPTs) 6. 13 14

NESTED PAGE TABLES Each guest maintains page tables to translate virtual to physical addresses VMM maintains per guest NPTs to represent guest s page-table state When guest on CPU VMM makes that guest s NPTs the active system page tables Guest tries to change page table VMM makes equivalent change to NPTs and its own page tables Can cause many more TLB misses much slower performance

NESTED PAGE TABLES 6. 15

HARDWARE ASSISTANCE All virtualization needs some HW support More support more feature rich, stable, better performance of guests Intel added new VT-x instructions in 2005 and AMD the AMD-V instructions in 2006 CPUs with these instructions remove need for binary translation Generally de ne more CPU modes guest and host 6. 16

HARDWARE ASSISTANCE VMM can enable host mode, de ne characteristics of each guest VM, switch to guest mode and guest(s) on CPU(s) In guest mode, guest OS thinks it is running natively, sees devices (as de ned by VMM for that guest) Access to virtualized device, priv instructions cause trap to VMM CPU maintains VCPU, context switches it as needed HW support for Nested Page Tables, DMA, interrupts as well over time 6. 17

TYPES OF VIRTUAL MACHINES AND THEIR IMPLEMENTATIONS 67. 18. 1

TYPES OF VIRTUAL MACHINES AND THEIR IMPLEMENTATIONS Many variations as well as HW details Assume VMMs take advantage of HW features HW features can simplify implementation, improve performance Whatever the type, a VM has a lifecycle 7. 2

VIRTUAL MACHINE LIFE CYCLE 1. Created by VMM 2. Resources assigned to it (number of cores, amount of memory, networking details, storage details) In type 0 hypervisor, resources usually dedicated Other types dedicate or share resources, or a mix

VIRTUAL MACHINE LIFE CYCLE When no longer needed, VM can be deleted, freeing resouces Steps simpler, faster than with a physical machine install Can lead to virtual machine sprawl with lots of VMs, history and state dif cult to track 7. 34

TYPE 0 HYPERVISOR Old idea, under many names by HW manufacturers partitions, domains A HW feature implemented by rmware OS need to nothing special, VMM is in rmware Smaller feature set than other types Each guest has dedicated HW

TYPE 0 HYPERVISOR I/O a challenge as dif cult to have enough devices, controllers to dedicate to each guest Sometimes VMM implements a control partition running daemons that other guests communicate with for shared I/O Can provide virtualization-within-virtualization (guest itself can be a VMM with guests Other types have dif culty doing this 7. 5

TYPE 0 HYPERVISOR 7. 6

TYPE 1 HYPERVISOR Special purpose OS that run natively on HW Rather than providing system call interface, create run and manage guest OSes Can run on Type 0 hypervisors but not on other Types Run in kernel mode Guests generally don t know they are running in a VM Implement device drivers for host HW Also provide other traditional OS services like CPU and memory management 7. 7

TYPE 1 HYPERVISOR Commonly found in company datacenters In a sense becoming datacenter operating systems Datacenter managers control and manage OSes in new, sophisticated ways by controlling the Type 1 hypervisor Consolidation of multiple OSes and apps onto less HW Move guests between systems to balance performance Snapshots and cloning 7. 8

TYPE 1 HYPERVISOR Another variation is a general purpose OS that also provides VMM functionality RedHat Enterprise Linux with KVM, Windows with Hyper-V, Oracle Solaris Perform normal duties as well as VMM duties Typically less feature rich than dedicated Type 1 hypervisors In many ways, treat guests OSes as just another process Albeit with special handling when guest tries to execute special instructions 7. 9

TYPE 2 HYPERVISOR Very little OS involvement in virtualization VMM is simply another process, run and managed by host Even the host doesn t know they are a VMM running guests Tend to have poorer overall performance because can t take advantage of some HW features But also a bene t because require no changes to host OS Student could have Type 2 hypervisor on native host, run multiple guests, all on standard host OS such as Windows, Linux, MacOS 7. 10

PARAVIRTUALIZATION Does not t the de nition of virtualization VMM not presenting an exact duplication of underlying hardware But still useful! VMM provides services that guest must be modi ed to use Leads to increased performance Less needed as hardware support for VMs grows 7. 11

PARAVIRTUALIZATION Xen, leader in paravirtualized space, adds several techniques For example, clean and simple device abstractions Ef cient I/O Good communication between guest and VMM about device I/O Each device has circular buffer shared by guest and VMM via shared memory 7. 12

XEN I/O VIA SHARED CIRCULAR BUFFER 7. 13

PARAVIRTUALIZATION Xen, leader in paravirtualized space, adds several techniques Memory management does not include nested page tables Each guest has own read-only tables Guest uses hypercall (call to hypervisor) when page-table changes needed 7. 14 15

PARAVIRTUALIZATION Paravirtualization allowed virtualization of older x86 CPUs (and others) without binary translation Guest had to be modi ed to use run on paravirtualized VMM But on modern CPUs Xen no longer requires guest modi cation no longer paravirtualization

PROGRAMMING ENVIRONMENT VIRTUALIZATION Also not-really-virtualization but using same techniques, providing similar features Programming language is designed to run within custom-built virtualized environment For example Oracle Java has many features that depend on running in Java Virtual Machine (JVM) Here, virtualization is de ned as providing APIs that de ne set of features for a language and programs in that language to provide an improved execution environment 7. 16

PROGRAMMING ENVIRONMENT VIRTUALIZATION JVM compiled to run on many systems (including some smart phones even) Programs written in Java run in the JVM no matter the underlying system Similar to interpreted languages 7. 17 18

EMULATION Another (older) way for running one operating system on a different operating system Virtualization requires underlying CPU to be same as guest was compiled for Emulation allows guest to run on different CPU Necessary to translate all guest instructions from guest CPU to native CPU Emulation, not virtualization

EMULATION Useful when host system has one architecture, guest compiled for other architecture Company replacing outdated servers with new servers containing different CPU architecture, but still want to run old applications Performance challenge order of magnitude slower than native code New machines faster than older machines so can reduce slowdown Very popular in gaming old consoles emulated on new 7. 19

APPLICATION CONTAINMENT Some goals of virtualization are segregation of apps, performance and resource management, easy start, stop, move, and management of them Can do those things without full- edged virtualization If applications compiled for the host operating system, don t need full virtualization to meet these goals 7. 20

APPLICATION CONTAINMENT Oracle containers / zones for example create virtual layer between OS and apps Only one kernel running host OS OS and devices are virtualized, providing resources in zone with impression they are only processes Each zone has its own applications; networking stack, addresses, and ports; user accounts, etc CPU and memory resources divided between zones Zone can have its own scheduler to use those resources 7. 21

SOLARIS 10 WITH TWO ZONES 7. 22

VIRTUALIZATION AND OPERATING-SYSTEM COMPONENTS 78. 23. 1

VIRTUALIZATION AND OPERATING-SYSTEM COMPONENTS Now look at operating system aspects of virtualization CPU scheduling, memory management, I/O, storage, and unique VM migration feature How do VMMs schedule CPU use when guests believe they have dedicated CPUs? How can memory management work when many guests require large amounts of memory?

OS COMPONENT CPU SCHEDULING Even single-cpu systems act like multiprocessor ones when virtualized One or more virtual CPUs per guest 8. 23

OS COMPONENT CPU SCHEDULING Generally VMM has one or more physical CPUs and number of threads to run on them Guests con gured with certain number of VCPUs Can be adjusted throughout life of VM When enough CPUs for all guests VMM can allocate dedicated CPUs, each guest much like native operating system managing its CPUs

OS COMPONENT CPU SCHEDULING Usually not enough CPUs CPU overcommitment VMM can use standard scheduling algorithms to put threads on CPUs Some add fairness aspect 8. 45

OS COMPONENT CPU SCHEDULING Cycle stealing by VMM and oversubscription of CPUs means guests don t get CPU cycles they expect Consider timesharing scheduler in a guest trying to schedule 100ms time slices each may take 100ms, 1 second, or longer Poor response times for users of guest Time-of-day clocks incorrect Some VMMs provide application to run in each guest to x time-of-day and provide other integration features

OS COMPONENT MEMORY MANAGEMENT Also suffers from oversubscription requires extra management ef ciency from VMM For example, VMware ESX guests have a con gured amount of physical memory, then ESX uses 3 methods of memory management 8. 67

MEMORY MANAGEMENT 1. Double-paging, in which the guest page table indicates a page is in a physical frame but the VMM moves some of those pages to backing store 2. Install a pseudo-device driver in each guest (it looks like a device driver to the guest kernel but really just adds kernel-mode code to the guest) Balloon memory manager communicates with VMM and is told to allocate or deallocate memory 3. Deduplication by VMM determining if same page loaded more than once, memory mapping the same page into multiple guests

OS COMPONENT I/O Easier for VMMs to integrate with guests because I/O has lots of variation Already somewhat segregated / exible via device drivers VMM can provide new devices and device drivers 8. 89

OS COMPONENT I/O Overall I/O is complicated for VMMs Many short paths for I/O in standard OSes for improved performance Less hypervisor needs to do for I/O for guests, the better Possibilities include direct device access, DMA pass-through, direct interrupt delivery Again, HW support needed for these

OS COMPONENT I/O Networking also complex as VMM and guests all need network access VMM can bridge guest to network (allowing direct access) And / or provide network address translation (NAT) NAT address local to machine on which guest is running, VMM provides address translation to guest to hide its address 8. 10

OS COMPONENT STORAGE MANAGEMENT Both boot disk and general data access need be provided by VMM Need to support potentially dozens of guests per VMM (so standard disk partitioning not suf cient) Type 1 storage guest root disks and con g information within le system provided by VMM as a disk image Type 2 store as les in le system provided by host OS 8. 11

OS COMPONENT STORAGE MANAGEMENT Duplicate le create new guest Move le to another system move guest Physical-to-virtual (P-to-V) convert native disk blocks into VMM format Virtual-to-physical (V-to-P) convert from virtual format to native or disk format VMM also needs to provide access to network attached storage (just networking) and other disk images, disk partitions, disks, etc 8. 12

OS COMPONENT LIVE MIGRATION Taking advantage of VMM features leads to new functionality not found on general operating systems such as live migration Running guest can be moved between systems, without interrupting user access to the guest or its apps Very useful for resource management, maintenance downtime windows, etc 8. 13

LIVE MIGRATION OF GUEST BETWEEN SERVERS 8. 14

OS COMPONENT LIVE MIGRATION 1. Source VMM establishes a connection with target VMM 2. Target creates a new guest by creating a new VCPU, etc 3. Source sends all read-only guest memory pages to target 4. Source sends all read-write pages to the target, marking them as clean 5. Source repeats step 4, as during that step some pages were probably modi ed by the guest and are now dirty 6. When cycle of steps 4+5 becomes very short, source VMM freezes guest, sends VCPU s nal state, other state details, and nal dirty pages, + tells target to start running guest 8. 15

EXAMPLES 89. 16. 1

VMWARE VMware Workstation runs on x86, provides VMM for guests Runs as application on other native, installed host operating system Type 2 Lots of guests possible, including Windows, Linux, etc all runnable concurrently (as resources allow) 9. 2

VMWARE Virtualization layer abstracts underlying HW, providing guest with is own virtual CPUs, memory, disk drives, network interfaces, etc Physical disks can be provided to guests, or virtual physical disks (just les within host le system) 9. 3

VMWARE WORKSTATION ARCHITECTURE

JAVA VIRTUAL MACHINE Example of programming-environment virtualization Very popular language / application environment invented by Sun Microsystems in 1995 Write once, run anywhere Includes language speci cation (Java), API library, Java virtual machine (JVM) Java objects speci ed by class construct, Java program is one or more objects 9. 4

JAVA VIRTUAL MACHINE Each Java object compiled into architecture-neutral bytecode output (.class) which JVM class loader loads JVM compiled per architecture, reads bytecode and executes Includes garbage collection to reclaim memory no longer in use Made faster by just-in-time (JIT) compiler that turns bytecodes into native code and caches them 9. 5

JAVA VIRTUAL MACHINE 9. 6

CONTAINERS 10 9. 71

DOCKER Docker originally used LinuX Containers (LXC), but later switched to runc (formerly known as libcontainer) Runs in the same operating system as its host. Allows to share a lot of the host operating system resources. Uses a layered lesystem (AuFS) Manages networking.

DOCKER - AUFS AuFS is a layered le system, so you can have a read only part and a write part which are merged together. One could have the common parts of the operating system as read only (and shared amongst all of your containers) and then give each container its own mount for writing. 10. 23

LAYERS Docker gives you the ability to snapshot the OS into a shared image, and makes it easy to deploy on other Docker hosts. All the same image. You start with a base image, and then make your changes, and commit those changes using docker, and it creates an image. This image contains only the differences from the base.

DIFFERENCE 10. 4

SIZE Let s say you have a 1 GB container image If you wanted to use a full VM, you would need to have 1 GB times x number of VMs you want. With Docker and AuFS you can share the bulk of the 1 GB between all the containers. If you have 1000 containers you still might only have a little over 1 GB of space for the containers OS (assuming they are all running the same OS image). 10. 5

DIFFERENCES VM A full virtualized system gets its own set of resources allocated to it, and does minimal sharing. You get more isolation, but it is much heavier (requires more resources). Container With Docker you get less isolation, but the containers are lightweight (require fewer resources). So you could easily run thousands of containers on a host, and it won t even blink. 10. 6

SPEED Full virtualized system usually takes minutes to start Docker/LXC/runC containers take seconds, and often even less than a second. 10. 78

PROS/CONS If you want full isolation with guaranteed resources, a full VM is the way to go. If you just want to isolate processes from each other and want to run a ton of them on a reasonably sized host, then Docker/LXC/runC seems to be the way to go. 10. 9

QUESTIONS 11. 1

BONUS Exam question number 12: Virtual Machines 11. 2