• 沒有找到結果。

Lecture 1: So … What Is A Virtual Machine?

N/A
N/A
Protected

Academic year: 2022

Share "Lecture 1: So … What Is A Virtual Machine?"

Copied!
42
0
0

加載中.... (立即查看全文)

全文

(1)

Virtual Machines: Concepts & Applications

Mohamed Zahran (aka Z) mzahran@cs.nyu.edu http://www.mzahran.com

CSCI-GA.3033-015

Lecture 1: So … What Is A Virtual Machine?

Disclaimer: Many slides of this lecture

are based on the slides of authors of the textbook from Elsevier.

All copyrights reserved.

(2)

Who Am I?

Mohamed Zahran (aka Z)

http://www.mzahran.com

Research interest:

computer architecture

hardware/software interaction Biologically-inspired machines

Office hours: Tue 1-3 pm

or by appointment

Room: WWH 320

(3)

Formal Goals of The Course

• Understand VM architectures and applications

• Study key implementation technologies

• Focus on architecture and

microarchitecture aspects; as well as software aspects

• Cover significant case studies

(4)

Informal Goals of This Course

• Be an expert in how programming

languages, compilers, OS, and computer architecture interact together!

• Be able to use the technology learned in this course in many different situations

• Build a vision about technology and its future

• Enjoy the course

(5)

The Textbook

(6)

Grades

You have 3 sources of study information:

Slides

Notes you take in class

Reading material from the textbook

Exam is open book/notes

Grade distribution:

Homework assignments 30%

Project 30%

Final exam 40%

(7)

We Have to Admit that …

• Computers are very complicated structures!

• In order to manage/design them, we need to be able to manage extreme complexity!

• The best way to do that is through:

levels of abstraction with well defined interfaces

(8)

Abstraction

Computer systems are built on levels of abstraction

Higher level of abstraction hide details at lower levels

Example: files are an abstraction of a disk

file file

abstraction

I/O devices and Networking Controllers

System Interconnect (bus)

Controllers Memory Translation Execution Hardware

Drivers Memory

Manager Scheduler Operating System

Libraries Application

Programs

Main Memory

Software

Hardware

(9)

Abstraction provides:

Simplified interface to underlying resources.

(10)

High Level Language

Assembly Language

Machine Language

Microarchitecture

Logic Level

Problem  Algorithm Development  Programmer

Compiler (translator)

Assembler (translator)

Control Unit (Interpreter)

Microsequencer (Interpreter)

Device Level  Semiconductors  Quantum

(11)

Advantages of Well-defined Interfaces

Major design tasks are decoupled

Different hardware and software development schedules

Example of interfaces:

Instruction set architecture (ISA) OS interface (system calls)

Software can run on any machine supporting a compatible interface

PowerPC or x86 MacOS

MacIntosh apps.

x86 Linux

Linuxapps

x86 Windows

Windowsapps.

(12)

12

Major Program Interfaces

ISA Interface -- supports all conventional software

System Calls

User ISA System ISA

ISA

Application Software Operating System

System Calls

User ISA System ISA

ABI

Application Software Operating System

Application Binary Interface (ABI)

-- supports application software only

(13)

There are also disadvantages…

Software compiled for one ISA will not run on hardware with a different ISA

Apple Mac (PowerPC) binaries on an x86?

Even if ISAs are the same, OSes may differ

Windows NT applications on a Solaris x86?

Binary may not be optimized for the specific hardware platform it runs on

Intel Pentium 4 binaries on an AMD Athlon?

MacOS

MacIntosh apps

ARM x86

Windows apps.

Linux

(14)

Disadvantages (contd.)

Innovation may be inhibited by fixed ISA

Hard to add new instructions

OR remove obsolete ones

What was the most recent (successful) new ISA?

Or new OS?

Difficult for software to interact directly with implementation

Performance features Power management Fault tolerance

Software is supposed to be implementation independent

(15)

Diversity in instruction sets,

OSes, and programming languages

Encourages innovations Discourages stagnation

In practice, diversity leads to reduced interoperability.

BUT

How to deal with this in our world of networked computers, where it is advantageous To move software as freely as data??

(16)

A Look at Hardware Resources

Conventional system software manages hardware resources directly

An OS manages the physical memory of a specific size

I/O devices are managed as physical entities

Difficult to share resources except through OS All users of hardware must use the same OS

All users are vulnerable to attack from other users sharing the resource (via security holes in OS)

Can we do better?

(17)

Virtualization is the answer!

Real system is transformed so that it appears to be different!

An isomorphism from guest to host

Map guest state to host state Implement “equivalent” functions

S i S

S i ' S j '

Guest

Host

V( S i ) V( S j ) e (S i )

e '(S i ')

j

(18)

Virtualization

Similar to abstraction

Except

Details not necessarily hidden

Construct Virtual Disks

As files on a larger disk Map state

Implement functions

file file

virtualization

abstraction

(19)

The “Machine”

Different perspectives on what the Machine is:

OS developer

Compiler developer

Application programmer

I/O devices and Networking

System Interconnect (bus)

Memory Translation Execution Hardware

Application Programs

Main Memory Operating System

Libraries

(20)
(21)

Hardware

"Machine"

OS

Applications

Virtualizing Software

Virtual Machine

OS

Applications

Guest

VMM

Host

Virtual Machines

add Virtualizing Software to a Host platform

and support Guest process or system on a Virtual Machine (VM) Example: System Virtual Machine

(22)

Example of VM Usages

• A virtualizing software installed on an Apple Macintosh can provide a

Windows/IA-32 VM capable of running PC application programs.

• Multiple, replicated VMs can be implemented on a single hardware

platform to provide groups/individuals with their own OS environments

(23)

Example of VM Usages

• A large multiprocessor server can be divided into smaller virtual servers.

• VM can provide dynamic, on-the-fly optimization of program binaries.

• …

(24)

The Family of Virtual Machines

Lots of things are called “virtual machines”

IBM VM/370 Java

VMware

Some things not called “virtual machines”, are virtual machines

IA-32 EL Dynamo

Transmeta Crusoe

(25)

Virtual Machines

Process Virtual Machines System Virtual Machines

The process of virtualization involves two steps:

1. Mapping of virtual resources or state to real resources of the underlying machine.

2. Using real machine instructions and/or system calls

to carry out the actions specified by the VM instructions.

(26)

Process VMs

Execute application binaries with an ISA different from hardware platform

Provide user application with a virtual ABI environment

Can provide: replication, emulation, and optimization

Examples: IA-32 EL, FX!32

Virtualizing Software Application Process

Machine OS

Hardware

Guest Runtime

Host

Application Process

Virtual Machine

(27)

Process Virtual Machines

Constructed at ABI level

Runtime manages guest process

Not persistent

Guest processes may intermingle with host processes

As a practical matter, guest and host OSes are often the same

Dynamic optimizers are a special case

Examples: IA-32 EL, FX!32, Dynamo

HOST OS

Disk

file sharing

network communication guest

process

create host process

guest process

runtime runtime

guest process

runtime

host process

(28)

Example of Process VM:

FX!32

Application compiled for source ISA (in this example IA-32)

Executed on a machine with target ISA (in this example Dec Alpha)

(29)

Process VM: Replication

• OS providing the illusion of multiprogramming

• Each user process thinks it has the complete machine to itself

(30)

Process VM: Emulation

• Supports program binaries compiled for a different instruction set than the

host hardware  emulates one

instruction set on hardware designed for another instruction set

• Interpretation Vs Translation

(31)

Process VM: Optimization

Same-ISA Dynamic Binary Optimizers

Optimize Binary at Runtime

Instruction sets for host and guest are the same

Example HP Dynamo

Can optimize for dynamic properties of program

Can optimize for a specific

processor implementation HP PA

UNIX

HP Apps

(32)

Process VM:

High Level Language Virtual Machines

VM environment does not directly correspond to any real platform

VM environment designed for:

ease of portability

to match features of HLL used for program development.

HLL Program

Intermediate Code

Memory Image Object Code

( ISA )

Compiler front-end

Compiler back-end

Loader

HLL Program

Portable Code ( Virtual ISA )

Host Instructions Virt. Mem. Image

Compiler

VM loader

VM Interpreter/Translator

Traditional HLL VM

(33)

HLL VM: Example JVM

Sparc Workstation

Java Binary Classes

x86 PC

Apple Mac VM

implementation

VM implementation

VM implementation

Java VM Architecture

(34)

System Virtual Machines

Provide a complete system environment

Constructed at ISA level

Persistent

Examples: IBM

VM/360, VMware, Transmeta Crusoe

guest process

HOST PLATFORM Guest OS

VMM guest

process

guest process

guest process Guest OS2

VMM guest

process guest process

A single host hardware platform can support multiple guest OS environments simultaneously.

(35)

System Virtual Machines

Native VM System

VMM privileged mode Guest OS user mode Example: classic IBM

VMs

User-mode Hosted VM

VMM runs as user application

Dual-mode Hosted VM

Parts of VMM

privileged;

parts non-privileged Example VMware

Non-privileged modes

Privileged Mode Virtual

Machine

VMM

Hardware Virtual Machine

Host OS

Hardware VMM Virtual Machine

Host OS

Hardware VMM

(36)

Examples

(37)

Examples

(38)

Co-Designed VMs

Different objective:

Enable innovative ISA and/or hardware implementation for improved performance and/or power.

(39)

Co-Designed VMs

VLIW Windows

X86 Apps

Perform both translation and optimization

VM provides interface between standard ISA software and implementation ISA

Transmeta Crusoe and IBM Daisy best- known examples

(40)

Composition: Example

Java application

Linux x86

JVM

Windows x86

VMware

Crusoe VLIW

Binary Translation

A computer user has a Java application running on laptop PC

The user has Linux installed on Windows PC via Vmware.

The IA-32 hardware is in fact a Transmeta Crusoe implementing VLIW ISA.

(41)

Taxonomy

Multiprogrammed Systems

Java VM MS CLI

Transmeta Crusoe

same ISA different

ISA

Process VMs System VMs

Virtual PC for Mac different

ISA same ISA

IBM VM/370

VMware HP

Dynamo

IA-32 EL FX!32

(42)

Conclusions

Virtualization will be a key part of future computer systems.

A fourth major discipline? (with HW, System SW, Application SW)

VMs have been investigated and built by OS developers, language designers,

compiler developers, and hardware designers!

In this course, we will study the underlying concepts and technologies that are

common across the whole spectrum.

參考文獻

相關文件

• The Java programming language is based on the virtual machine concept. • A program written in the Java language is translated by a Java compiler into Java

• If there are many challenges and few supports, the text is probably best for storytelling or reading aloud.. • If there are more challenges than supports, the text is probably

Courtesy: Ned Wright’s Cosmology Page Burles, Nolette & Turner, 1999?. Total Mass Density

Children explore the online world alone, but they use message boards to share what they find and what they do in the different creative studios around the virtual space.. In

The evidence presented so far suggests that it is a mistake to believe that middle- aged workers are disadvantaged in the labor market: they have a lower than average unemployment

Data larger than memory but smaller than disk Design algorithms so that disk access is less frequent An example (Yu et al., 2010): a decomposition method to load a block at a time

The packed comparison instructions compare the destination (second) operand to the source (first) oper- and to test for equality or greater than.. These instructions compare eight

¾ To fetch a Web page, browser establishes TCP connection to the machine where the page is and sends a message over the connection asking for the