Introduction to Virtual Machines Michael Jantz Acknowledgements - - PowerPoint PPT Presentation
Introduction to Virtual Machines Michael Jantz Acknowledgements - - PowerPoint PPT Presentation
Introduction to Virtual Machines Michael Jantz Acknowledgements Slides adapted from Chapter 1 in Virtual Machines: Versatile Platforms for Systems and Processes by James E. Smith and Ravi Nair Credit to Prasad A. Kulkarni some slides
Acknowledgements
- Slides adapted from Chapter 1 in Virtual
Machines: Versatile Platforms for Systems and Processes by James E. Smith and Ravi Nair
- Credit to Prasad A. Kulkarni – some slides
were borrowed from his course on Virtual Machines at the University of Kansas
2
Introduction to Virtual Machines
- Abstraction and interfaces
- Virtualization
- Computer system architecture
- Process virtual machines
- System virtual machines
3
Abstraction
- Mechanism to manage complexity in
computer systems.
- Partitions design of a system into levels
- Allows higher levels to ignore the
implementation details of lower levels
4
Interfaces
- Define the communication b/w two entities
- Hierarchical relationship
- Linear relationship
- Software can run on any machine
supporting a compatible interface
5
PowerPC MacOS MacIntosh apps. x86 Linux Linux apps x86 Windows Windows apps.
Interfaces: Advantages
- Allows de-coupling of design tasks
- Work on different components can progress
independently
- Helps manage system complexity
- Each component provides an abstraction of
itself to the outside world
6
Interfaces: Disadvantages
- Limit flexibility
- Developers must work within the constraints
- f the interface
- Can be confining
- ARM binaries on x86 machine?
- Windows applications on Linux?
7
MacOS MacIntosh apps x86 x86 Windows apps. Linux
Interfaces: Disadvantages
- Inhibits innovation
- Hard to change instruction sets
- Application software cannot directly exploit
microprocessor features
- Software is supposed to be architecture
independent!
8
Virtualization
- Map the interface of one system to a real
system that actually implements it
- Removes constraints imposed by interfaces
- Improves availability of application software
- Removes the assumption of a single regime,
improves security and failure isolation
- Provide a different view to a particular
computer resource
- Not necessarily a simpler view
9
Virtualization
- Creates an isomorphism that maps a
virtual guest to a real host
10
Si S Si ' S
j'
Guest Host
V( S
i)
V(S
j)
e(S
i)
e '(Si')
j
Virtualization vs. Abstraction
- Virtualization does not necessarily hide details
11
file file virtualization
Virtual Machines
- Virtualization applied to the entire machine
- Adds a layer of software to a real machine
to support the desired architecture
- Process of virtualization
- Maps virtual resources or state to real
resources
- Uses real machine instructions to carry out
actions specified by the VM instructions
12
Benefits of VM's
- Flexibility
- Portability
- Isolation
- Security
13
Computer Architecture
- Architecture: functionality and appearance
- f a computer system
- Implementation: embodiment of the
architecture
14
Computer Architecture
- Computer systems
consist of:
- Layers of abstraction
- Well-defined interfaces
15
I/O devices and Networking System Interconnect (bus) Memory Translation Execution Hardware Application Programs Main Memory Operating System Libraries
The ISA Interface
- Interface between
hardware & software
- Two parts
- System ISA
- User ISA
16
I/O devices and Networking System Interconnect (bus) Memory Translation Execution Hardware Application Programs Main Memory Operating System Libraries
The ISA Interface
- System ISA
- Important for OS
developers
17
I/O devices and Networking System Interconnect (bus) Memory Translation Execution Hardware Application Programs Main Memory Operating System Libraries
The ABI Interface
- Application Binary
Interface (ABI)
- User ISA + system calls
- Important for compiler
writers
18
I/O devices and Networking System Interconnect (bus) Memory Translation Execution Hardware Application Programs Main Memory Operating System Libraries
The API Interface
- Application
Programming Interface (API)
- User ISA + library calls
- Important for
application programmers
19
I/O devices and Networking System Interconnect (bus) Memory Translation Execution Hardware Application Programs Main Memory Operating System Libraries
Major Program Interfaces
- ISA – supports all conventional software
- ABI – supports application software only
20
System Calls User ISA System ISA
ISA
Application Software Operating System System Calls User ISA System ISA
ABI
Application Software Operating System
Process Virtual Machines
- Supports an individual process
- Run SW for a different OS and different ISA
- Couple at ABI level via runtime system
21
Virtualizing Software Application Process Machine OS Hardware
Guest Runtime Host
Application Process
Virtual Machine
Process Virtual Machines
- Guest processes intermingle
with host processes
- Binaries encapsulated by
the runtime
- PVM does not include OS
- Examples:
- Java
- IA-32 EL
- Dynamic optimizers
(dynamo)
HOST OS
Disk
file sharing network communication guest process create host process guest process
runtime runtime
guest process
runtime
host process
22
PVM: Multiprogramming
- OS provides PVMs for each application
- System calls + user ISA == PVM to
execute multiple, concurrent processes
- Each process is given the illusion of
having the entire machine to itself
23
PVM: Emulators
- Execute binaries compiled for one ISA on
a machine with a different ISA
- Emulation methods
- Interpretation
- Fast startup, but slow steady-state
- Dynamic binary translation
- High startup overhead, faster steady-state
- Uses a code cache to store translated blocks
- Examples: Java, IA32-EL
24
PVM: Binary Optimizers
- Same source and target ISAs
- Main task is optimization
- ABI level optimization
- May also collect performance profiles
- May also enhance security
- e.g., HP's Dynamo
25
PVM: High-Level Language VMs
- Designed for VM execution
- Aim to minimize HW- and OS-specific features
26
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
PVM: High-Level Language VMs
- Distribution format is binary class files
- Virtualized ISA (no real implementation)
- OS interaction via API
- Examples: Java, Micosoft CLI
27
Sparc Workstation Java Binary Classes x86 PC Apple Mac VM implementation VM implementation VM implementation
Java VM Architecture
System Virtual Machines
- Supports an OS with many user-level processes
- Couple at the ISA level
- Examples: VMWare, Transmeta Crusoe
28
Hardware "Machine" OS Applications Virtualizing Software
Virtual Machine
OS Applications
Guest VMM Host
Classic System Virtual Machine
- Original meaning of the term virtual machine
- All guest and host software use the same ISA
- VMM runs on bare hardware (privileged mode)
- VMM intercepts all privileged operations for the guest OS's
29
Linux process Win process HOST PLATFORM
virtual network communication
Guest OS (Windows) Win process Win process Guest OS2 (Linux)
VMM
Linux process Linux process
Hosted VM
- VMM built on top of existing OS
- Advantages
- Installs just like a user-level application
- Host OS provides driver support
- Drawbacks
- Less efficient
30
Whole System VMs
- Host and guest do not use a common ISA
- Both app and OS code require emulation
- Typically implemented as a hosted VMM
- Example: VirtualPC
31
Co-designed Virtual Machines
- Designed to enable innovative ISA's and/or
hardware implementations
- As if the VM software is part of the HW
- Applications / OS never directly execute native
ISA instructions
- Useful for backwards compatibility
- Example: Transmeta Crusoe
32
VM Taxonomy
33