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

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

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

CS370 Operating Systems

CS370 Operating Systems

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

Chapter 5 C. Virtual machines

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

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

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

Virtualization. Pradipta De

Module 1: Virtualization. Types of Interfaces

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

Distributed Systems COMP 212. Lecture 18 Othon Michail

COS 318: Operating Systems. Virtual Machine Monitors

CS370 Operating Systems

Virtual Machines. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

CHAPTER 16 - VIRTUAL MACHINES

COMPUTER ARCHITECTURE. Virtualization and Memory Hierarchy

CSE 120 Principles of Operating Systems

Lecture 5: February 3

Virtualization. Dr. Yingwu Zhu

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

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

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

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

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

Frequently asked questions from the previous class survey

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

Frequently asked questions from the previous class survey

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

VIRTUALIZATION: IBM VM/370 AND XEN

Cloud Computing Virtualization

Virtualization and memory hierarchy

Multiprocessor Scheduling. Multiprocessor Scheduling

Virtual Machine Monitors!

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

Frequently asked questions from the previous class survey

Virtualization. Adam Belay

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

Frequently asked questions from the previous class survey

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

NON SCHOLAE, SED VITAE

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

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

Virtualization. Darren Alton

Frequently asked questions from the previous class survey

Dept. Of Computer Science, Colorado State University

CHAPTER 16 - VIRTUAL MACHINES

Virtualization. Michael Tsai 2018/4/16

Virtual Machine Monitors (VMMs) are a hot topic in

Frequently asked questions from the previous class survey

The only open-source type-1 hypervisor

Nested Virtualization and Server Consolidation

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University

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

references Virtualization services Topics Virtualization

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

MANAGEMENT OF TASKS IN VIRTUALIZED ENVIRONMENTS

Concepts. Virtualization

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University

CS 550 Operating Systems Spring Introduction to Virtual Machines

Virtual machine architecture and KVM analysis D 陳彥霖 B 郭宗倫

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

Frequently asked questions from the previous class survey

Virtualization Introduction

Frequently asked questions from the previous class survey

DISCO and Virtualization

Hypervisor security. Evgeny Yakovlev, DEFCON NN, 2017

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

Frequently asked questions from the previous class survey

CS5460: Operating Systems. Lecture: Virtualization. Anton Burtsev March, 2013

LINUX Virtualization. Running other code under LINUX

Advanced Operating Systems (CS 202) Virtualization

Πποχωπημένη Κατανεμημένη Υπολογιστική

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

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

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

Virtual machines are an interesting extension of the virtual-memory concept: not only do we give processes the illusion that they have all of memory

Virtualization and Virtual Machines. CS522 Principles of Computer Systems Dr. Edouard Bugnion

CSCE 410/611: Virtualization!

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

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

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

Operating Systems 4/27/2015

Chapter 2: Operating-System Structures

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

Xen and the Art of Virtualization. Nikola Gvozdiev Georgian Mihaila

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

Virtualization. Guillaume Urvoy-Keller UNS/I3S

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

OS concepts and structure. q OS components & interconnects q Structuring OSs q Next time: Processes

Knut Omang Ifi/Oracle 6 Nov, 2017

CS370: Operating Systems [Fall 2018] Dept. Of Computer Science, Colorado State University

What are some common categories of system calls? What are common ways of structuring an OS? What are the principles behind OS design and

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

Chapter 2: Operating-System Structures

CS370: Operating Systems [Fall 2018] Dept. Of Computer Science, Colorado State University

Lecture 4: Extensibility (and finishing virtual machines) CSC 469H1F Fall 2006 Angela Demke Brown

Transcription:

Frequently asked questions from the previous class survey CS 370: OPERATING SYSTEMS [VIRTUALIZATION] Shrideep Pallickara Computer Science Colorado State University RAM: Implications of 3 2GB cards over 1 6GB card? Why does decreasing frames per-process increase page faults? Paging algorithms seem to assume both temporal and spatial locality how true is this profile? Does the second chance page replacement algorithm have more overheads than FIFO? Local/Global: what is used more commonly? L25.1 L25.2 Topics covered in this lecture Virtual Memory Working sets & thrashing TLB Reach, etc. Virtualization WORKING SETS & THRASHING L25.3 L25.4 Working set is an approximation of the program s locality Most important property of the working set is size Page reference table...2 6 1 5 7 7 7 7 5 1 6 2 3 4 4 4 3 4 3 4 4 4 1 2 3 4 8 Δ Δ WS = {1,2,5,6,7} WS = {3,4} WSS i = Working set size for process p i If total demand exceeds available frames Thrashing will occur Working sets and page fault rates The peak in page-fault rate happens when a new locality is being demand-paged Once working set is in memory Page fault rate falls When process moves towards a new working set window? Fault rate rises again L25.5 L25.6 SLIDES CREATED BY: SHRIDEEP PALLICKARA L25.1

The page fault frequency approach to reducing thrashing Using page fault frequencies to control thrashing: Establish bounds When the page fault rate is high Process needs more frames When the page fault rate is too low Process may have too many frames Page Fault rate Increase number of frames Upper Bound Decrease number of frames Lower Bound Number of frames L25.7 L25.8 Prepaging: Loading pages BEFORE letting a process run Bring into memory -- at one time -- all the pages that will be needed Prepage frames for small files With the working set model Ensure that the entire working set is in memory before the process is resumed OTHER CONSIDERATIONS L25.9 L25.10 TLB Reach is the amount of memory accessible from the TLB TLB-Reach = Number of TLB entries x Page Size Approaches to increasing TLB reach Double the entries n Expensive Increase page size n Increases (internal) fragmentation Support multiple page sizes n OS not hardware manages the TLB n Increase reach and hit ratio Current trend Select data structures and program structures efficiently Increase locality Reduce page fault rates Loops If data is stored in row-major format, but program reads it as column-major format Loader should avoiding placing routines across page boundaries L25.11 L25.12 SLIDES CREATED BY: SHRIDEEP PALLICKARA L25.2

What we will look at Memory and I/O Virtualization Why? Advantages Virtualization Brief History VIRTUALIZATION Type 1 and Type 2 hypervisors Techniques for efficiency Requirements L25.13 L25.14 WHY VIRTUALIZATION Firms often have multiple, dedicated servers: e-mail, FTP, e-commerce, web, etc. Load: May be one machine cannot handle all that load Reliability: Management does not trust the OS to run 24 x 7 without failures By putting one server on a separate computer, if one of the server crashes? At least the other ones are not affected If someone breaks into the web server, at least sensitive e-mails are still protected Sandboxing L25.15 L25.16 But While this approach achieves isolation and fault tolerance This solution is expensive and hard to manage because so many machines are also involved Other reasons for having separate machines? Organizations depend on more than one OS for their daily operations n Web server on Linux, mail server on Windows, e-commerce server on OS X, other services on various flavors of UNIX What to do? A possible (and popular) solution is to use virtual machine technology This sounds very hip and modern But the idea is old dating back to the 1960s Even so, the way we use it today is definitely new L25.17 L25.18 SLIDES CREATED BY: SHRIDEEP PALLICKARA L25.3

Main idea VMM (Virtual Machine Monitor) creates the illusion of multiple (virtual) machines on the same physical hardware VMM is also known as a hypervisor n We will look at type 1 hypervisors (bare metal) and type 2 hypervisors (use services and abstractions offered by an underlying OS) Virtualization allows a single computer to host multiple virtual machines Each potentially running a different OS L25.19 Failure in one virtual machines does not bring down any others Different servers run on different virtual machines Maintains partial-failure model at a lower cost with easier maintainability Also, we can run different OS on the same hardware Benefit from virtual machine isolation in the face of attacks Plus enjoy other good stuff: savings, real estate, etc. L25.20 But isn t consolidating servers like this putting all your eggs in the same basket? If the server running the virtual machines fails? The result is even more catastrophic than the crashing of a single dedicated server Why virtualization works [1/2] Service outages are due not to faulty hardware, but due to poor software, emphatically including OSes Ill-designed, unreliable, buggy, and poorly configured software L25.21 L25.22 Why virtualization works [2/2] The only software running in the highest privilege is the hypervisor Hypervisor has 2 orders of magnitude fewer lines of code than a full operating system Has 2 orders of magnitude fewer bugs A hypervisor is simpler than an OS because it does only one thing Emulate copies of the bare metal (most commonly the Intel x86 architecture) Advantages to running software in VMs besides strong isolation Few physical machines Saves money on hardware and electricity Takes up less rack space For companies such as Amazon or Microsoft Reducing physical demands on data centers represents huge cost savings Companies frequently locate their data centers in the middle of nowhere n Just to be close to hydroelectric dams (and cheap energy) L25.23 L25.24 SLIDES CREATED BY: SHRIDEEP PALLICKARA L25.4

Price-per-kilowatt hours by region: Easier to ship photons than electrons Price per KWH Where Possible Reasons Why 3.6 Idaho Hydroelectric power; not sent long distance 10.0 California Electricity transmitted long distance over the grid; Limited transmission lines in Bay Area; No coal fired electricity allowed in California. 18.0 Hawaii Must ship fuel to generate electricity Source: Above the Clouds: A Berkeley View of Cloud Computing. Armburst et al Technical Report 2009 Checkpointing and migration For load balancing across multiple servers Easier with VMs than migrating processes running on a normal OS Why? In the bare metal case, a fair amount of critical state information about each process is kept in OS tables When migrating a VM, all that has to be moved are the memory and disk images n All the OS tables move as well L25.25 L25.26 Other uses of virtual machines Run legacy applications Software development: Test software on myriad OSes No need to get a dozen computers and install a dozen OS n Just install a dozen VMs n Of course you could have partitioned hard-disk and installed a different OS but that is more difficult n Standard PCs allow only four primary disk-partitions, no matter how big the disk is n Although a multiboot program can be installed in the boot-block, it would be necessary to reboot computer to work on a new OS With VMs, all of them run at once, since they are just glorified processes Key idea of the cloud is straightforward Outsource computation/storage needs to a well managed data center Pay for use of resources, but at least you will not have to worry about physical machines, power, cooling, and maintenance L25.27 L25.28 1960s Early 1960s IBM experimented with not just one, but two independently developed hypervisors SIMMON and CP-40 A BRIEF HISTORY OF VIRTUALIZATION CP-40 was a research project that was reimplemented as CP-67 to form the control program of CP/CMS a virtual machine OS for IBM/360 L25.29 L25.30 SLIDES CREATED BY: SHRIDEEP PALLICKARA L25.5

1970s The path to VMware In 1974, Gerald Popek and Robert Goldberg published a seminal paper* Listed what conditions a computer architecture should satisfy to support virtualization efficiently Famously, the well-known x86 architecture that originated in the 1970s did not meet this for decades 1970s were very productive, seeing the birth of UNIX, Ethernet, Cray-1, Microsoft, and Apple *Formal Requirements for a Virtualizable Third Generation Architectures. Communications of the ACM. Volume 17 Issue 7, pp 412-421. 1974. L25.31 Researchers at Stanford developed a new hypervisor called Disco Went on to found VMware a virtualization giant n Offers type 1 and type 2 hypervisors VMware introduced its first virtualization solution for x86 in 1999 Other products followed in its wake Xen, KVM, VirtualBox, Hyper-V, Parallels L25.32 Requirements for virtualization Virtual machines must act just like the real McCoy Must be possible to boot them and install arbitrary OS on them n Just as on the real hardware REQUIREMENTS FOR VIRTUALIZATION Task of the hypervisor is to provide this illusion and to do it efficiently L25.33 L25.34 Hypervisors should score well on Safety Hypervisor should have full control of the virtualized resources Fidelity Behavior of program on a virtual machine should be identical to the same program running on bare hardware Efficiency Much of the code in the virtual machine should run without intervention from the hypervisor Safety Consider each instruction in turn in an interpreter (such as Bochs) and perform exactly what is needed May execute some instructions (INC) as is, but other instructions must be simulated We cannot allow the guest OS to disable interrupts for the entire machine or modify page-table mappings Trick is to make the guest OS believe that it has Interpreter may be safe, even hi-fi, but performance is abysmal So, VMMs try to execute most code directly L25.35 L25.36 SLIDES CREATED BY: SHRIDEEP PALLICKARA L25.6

Fidelity [1/2] Fidelity [2/2] Virtualization has long been a problem on x86 Defects in 386 carried forward into new CPUs for 20 years in the name of backward compatibility Every CPU with kernel mode and user mode has instructions that behave differently Depending on whether it is executed in kernel/user mode n Sensitive instructions Some instructions cause a trap when executed in user-mode n Privileged instructions A machine is virtualizable only if sensitive instructions are a subset of privileged instructions L25.37 If you do something in user mode that you should not The hardware should trap! IBM/370 had this property, Intel s 386 did not Several sensitive 386 instructions were ignored if executed in user mode Or executed with a different behavior E.g. POPF instruction replaces flags register which changes the bit that enables/disables interrupts n In user-mode this bit was simply not changed Also, some instructions could read sensitive state in user mode without causing a trap L25.38 Problem solved in 2005 What happened before that? When Intel and AMD introduced virtualization in their CPUs Intel CPUs: It is called VT (Virtualization Technology) AMD CPUs: SVM (Secure Virtual Machine) Create containers in which VMs can be run When a guest OS is started in a container, continues to run until it causes an exception and traps to the hypervisor For e.g. by executing an I/O instruction Hypervisors before 2005 did not really run the original guest OS Rewrote part of the code on the fly n To replace problematic instructions with safe code sequences that emulated original instruction n Replace instructions that are sensitive but not privileged n Binary Translation Set of operations that trap is controlled by a hardware bit map set by hypervisor Classical trap-and-emulate approach becomes possible L25.39 L25.40 Full virtualization Trap all instructions Fully simulate entire computer Trade-off: High overhead Benefit: Can virtualize any OS Paravirtualization [1/2] Never aims to present a virtual machine that looks just like the actual underlying hardware Present machine-line software interface that explicitly exposes that it is a virtualized environment Offers a set of hypercalls that allow the guest to send explicit requests to the hypervisor n Similar to how a system call offers kernel services to applications DRAWBACK: Guest OS has to be aware of the virtual machine API L25.41 L25.42 SLIDES CREATED BY: SHRIDEEP PALLICKARA L25.7

Paravirtualization [2/2] Guests use hypercalls for privileged, sensitive operations like updating page tables But they do it in cooperation with the hypervisor Overall system can be simpler and faster Paravirtualization was offered by IBM since 1972 Idea was revived by Denali (2002) and Xen (2003) hypervisors Not all virtualization attempt to trick the guest into believing it has entire system Sometimes the aim is allow a process to run that was run on different OS and/or architecture Process-level virtualization Examples: WINE Compatibility layer allows Windows applications to run on POSIX-compliant systems like Linux, BSD, OS X Process-level version of the QEMU emulator allows applications for one architecture to run on another L25.43 L25.44 Terms Guest Operating System The OS running on top of the hypervisor Host Operating System For a type 2 hypervisor: the OS that runs on the hardware TYPE-1 AND TYPE-2 HYPERVISORS Safe executions Execute the machine s instruction set in a safe manner Guest OSes may change or mess up its own page tables but not those of others L25.45 L25.46 Type 1 hypervisor Location of Type-1 hypervisor Only program running in the most privileged mode Support multiple copies of the actual hardware Virtual machines Similar to processes a normal OS would run Excel Word Windows Emacs Linux Control Domain Type 1 hypervisor Hardware (CPU, disk, network, interrupts, etc) L25.47 L25.48 SLIDES CREATED BY: SHRIDEEP PALLICKARA L25.8

Control Domain in the Type-1 hypervisor: Also known as Dom0 Is a VM like the guest VMs, with two functional differences Has the ability to talk to the hypervisor to instruct it to start and stop guest VMs By default contains the device drivers needed to address the hardware Type 2 hypervisor Also referred to a hosted hypervisor Relies on a host OS, say Windows or Linux, to allocate and schedule resources Still pretends to be a full computer with a CPU and other devices L25.49 L25.50 Type 2: Running Guest OS When it starts for the first time, acts like a newly booted computer Expects to find a DVD, USB drive or CD-ROM containing an OS n The drive could be a virtual device n Store the image as an ISO file on the hard drive and have hypervisor pretend its reading from proper DVD drive Hypervisor installs the OS to its virtual disk (just a file) by running installation that it found on DVD Once guest OS is installed on virtual disk, it can be booted and run Location of Type-2 hypervisor Guest OS Processes Guest OS (e.g. Windows) Type 2 hypervisor Host OS (e.g. Linux) Hardware (CPU, disk, network, interrupts, etc) Host OS Process L25.51 L25.52 Examples of hypervisors [Partial List] Virtualization Method Type 1 hypervisor Type 2 hypervisor Virtualization without hardware support Paravirtualization Xen 1.0 Virtualization with vsphere, Xen, Hyper-V hardware support Process Virtualization ESX Server 1.0 VMware workstation 1.0 VMware Fusion, KVM, Parallels WINE The contents of this slide-set are based on the following references Avi Silberschatz, Peter Galvin, Greg Gagne. Operating Systems Concepts, 9 th edition. John Wiley & Sons, Inc. ISBN-13: 978-1118063330. [Chapter 9, 16] Andrew S Tanenbaum and Herbert Bos. Modern Operating Systems. 4 th Edition, 2014. Prentice Hall. ISBN: 013359162X/ 978-0133591620. [Chapter 7] L25.53 L25.54 SLIDES CREATED BY: SHRIDEEP PALLICKARA L25.9