Goals for Today Learning Objective: Define a taxonomy for - - PowerPoint PPT Presentation

goals for today
SMART_READER_LITE
LIVE PREVIEW

Goals for Today Learning Objective: Define a taxonomy for - - PowerPoint PPT Presentation

Goals for Today Learning Objective: Define a taxonomy for virtualization architectures Announcements, etc: C4 Submission for 3/9, 3/15 open (sorry for the delay) Request for Informal Early Feedback forthcoming, probably on


slide-1
SLIDE 1

CS 423: Operating Systems Design 1

Goals for Today

Reminder: Please put away devices at the start of class

  • Learning Objective:
  • Define a taxonomy for virtualization architectures
  • Announcements, etc:
  • C4 Submission for 3/9, 3/15 open (sorry for the delay)
  • Request for “Informal Early Feedback” forthcoming, probably on Monday
  • Midterm debrief forthcoming, probably on Wednesday
slide-2
SLIDE 2

CS 423: Operating Systems Design

Professor Adam Bates Spring 2017

CS 423
 Operating System Design: Virtual Machines

slide-3
SLIDE 3

CS 423: Operating Systems Design

Virtual Machines

3

  • What is a virtual machine?
  • Examples?
  • Benefits?
slide-4
SLIDE 4

CS 423: Operating Systems Design

Virtualization

4

  • Creation of an isomorphism that maps a virtual

guest system to a real host:

– Maps guest state S to host state V(S) – For any sequence of operations on the guest that changes guest state S1 to S2, there is a sequence of

  • perations on the host that maps state V(S1) to V(S2)
slide-5
SLIDE 5

CS 423: Operating Systems Design

Important Interfaces

5

  • Application programmer interface (API):

– High-level language library such as clib

  • Application binary interface (ABI):

– User instructions (User ISA) – System calls

  • Hardware-software interface:

– Instruction set architecture (ISA)

slide-6
SLIDE 6

CS 423: Operating Systems Design

What’s a machine?

6

  • Machine is an entity that provides an interface

– Language view:

  • Machine = Entity that provides the API

– Process view:

  • Machine = Entity that provides the ABI

– Operating system view:

  • Machine = Entity that provides the ISA
slide-7
SLIDE 7

CS 423: Operating Systems Design

What’s a virtual machine?

7

  • Virtual machine is an entity that emulates a guest

interface on top of a host machine

– Language view:

  • Virtual machine = Entity that emulates an API (e.g., JAVA) on top of

another

  • Virtualizing software = compiler/interpreter

– Process view:

  • Machine = Entity that emulates an ABI on top of another
  • Virtualizing software = runtime

– Operating system view:

  • Machine = Entity that emulates an ISA
  • Virtualizing software = virtual machine monitor (VMM)
slide-8
SLIDE 8

CS 423: Operating Systems Design

Purpose of a VM

8

  • Emulation

– Create the illusion of having one type of machine on top of another

  • Replication (/ Multiplexing)

– Create the illusion of multiple independent smaller guest machines on top of one host machine (e.g., for security/isolation, or scalability/sharing)

  • Optimization

– Optimize a generic guest interface for one type of host

slide-9
SLIDE 9

CS 423: Operating Systems Design

Types of VMs

9

  • Emulate (ISA/ABI/API) for purposes of

(Emulation/Replication/Optimization) on top of (the same/different) one.

slide-10
SLIDE 10

CS 423: Operating Systems Design

Types of VMs

10

  • Emulate (ISA/ABI/API) for purposes of

(Emulation/Replication/Optimization) on top of (the same/different) one.

– Process/language virtual machines (emulate ABI/API) – System virtual machines (emulate ISA)

slide-11
SLIDE 11

CS 423: Operating Systems Design

Types of VMs

11

  • Emulate (ISA/ABI/API) for purposes of

(Emulation/Replication/Optimization) on top of (the same/different) one.

– Process/language virtual machines (emulate ABI/API) – System virtual machines (emulate ISA)

slide-12
SLIDE 12

CS 423: Operating Systems Design

Ex1: Multiprogramming

12

  • Emulate what interface?
  • For what purpose?
  • On top of what?
slide-13
SLIDE 13

CS 423: Operating Systems Design

Ex1: Emulation

13

  • Emulate one ABI on top of another

– Emulate a Intel IA-32 running Windows on top of PowerPC running MacOS (i.e., run a process compiled for IA-32/Windows on PowerPC/MacOS)

  • Interpreters: Pick one guest instruction at a time, update

(simulated) host state using a set of host instructions

  • Binary translation: Do the translation in one step, not one

line at a time. Run the translated binary

slide-14
SLIDE 14

CS 423: Operating Systems Design

Writing an Emulator

14

  • Create a simulator data structure to represent:

– Guest memory

  • Guest stack
  • Guest heap

– Guest registers

  • Inspect each binary instruction (machine

instruction or system call)

– Update the data structures to reflect the effect of the instruction

slide-15
SLIDE 15

CS 423: Operating Systems Design

Ex2: Binary Optimization

15

  • Emulate one ABI on top of itself for purposes of
  • ptimization

– Run the process binary, collect profiling data, then implement it more efficiently on top of the same machine/OS interface.

slide-16
SLIDE 16

CS 423: Operating Systems Design

Ex3: Language VMs

16

  • Emulate one API on top of a set of different ABIs

– Compile guest API to intermediate form (e.g., JAVA source to JAVA bytecode) – Interpret the bytecode on top of different host ABIs

  • Examples:

– JAVA – Microsoft Common Language Infrastructure (CLI), the foundation of .NET

slide-17
SLIDE 17

CS 423: Operating Systems Design

Types of VMs

17

  • Emulate (ISA/ABI/API) for purposes of

(Emulation/Replication/Optimization) on top of (the same/different) one.

– Process/language virtual machines (emulate ABI/API) – System virtual machines (emulate ISA)

slide-18
SLIDE 18

CS 423: Operating Systems Design

Types of VMs

18

  • Emulate (ISA/ABI/API) for purposes of

(Emulation/Replication/Optimization) on top of (the same/different) one.

– Process/language virtual machines (emulate ABI/API) – System virtual machines (emulate ISA)

slide-19
SLIDE 19

CS 423: Operating Systems Design

System VMs

19

  • Implement VMM (ISA emulation) on bare

hardware

– Efficient – Must wipe out current operating system to install – Must support drivers for VMM

  • Implement VMM on top of a host OS (Hosted

VM)

– Less efficient – Easy to install on top of host OS – Leverages host OS drivers

slide-20
SLIDE 20

CS 423: Operating Systems Design

System VMs

20

  • Implement VMM (ISA emulation) on bare

hardware

– Efficient – Must wipe out current operating system to install – Must support drivers for VMM

  • Implement VMM on top of a host OS (Hosted

VM)

– Less efficient – Easy to install on top of host OS – Leverages host OS drivers

TYPE ONE HYPERVISOR TYPE TWO HYPERVISOR

slide-21
SLIDE 21

CS 423: Operating Systems Design

Whole System VMs

21

  • Emulate one ISA on top of another

– Typically runs on top of host OS (e.g., install Windows compiled for IA-32 on top of MacOS running on PowerPC) – Note: this is different from a process virtual machine that emulates the Windows interface and user IA-32 instructions on top of MacOS running on PowerPC

slide-22
SLIDE 22

CS 423: Operating Systems Design

Emulation

23

  • Problem: Emulate guest ISA on host ISA
slide-23
SLIDE 23

CS 423: Operating Systems Design 24

  • Problem: Emulate guest ISA on host ISA
  • Solution: Basic Interpretation

inst = code (PC)

  • pcode = extract_opcode (inst)

switch (opcode) { case opcode1 : call emulate_opcode1 () case opcode2 : call emulate_opcode2 () … }

Emulation

slide-24
SLIDE 24

CS 423: Operating Systems Design 25

Emulation

  • Problem: Emulate guest ISA on host ISA
  • Solution: Basic Interpretation

new inst = code (PC)

  • pcode = extract_opcode (inst)

routineCase = dispatch (opcode) jump routineCase … routineCase call routine_address jump new

slide-25
SLIDE 25

CS 423: Operating Systems Design

Threaded Implementation

26

[ body of emulate_opcode1 ] inst = code (PC)

  • pcode = extract_opcode (inst)

routine_address = dispatch (opcode) jump routine_address [ body of emulate_opcode2] inst = code (PC)

  • pcode = extract_opcode (inst)

routine_address = dispatch (opcode) jump routine_address