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 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 MacIntosh apps. Windows apps . Linux apps MacOS Windows Linux PowerPC x86 x86 5
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 of the interface • Can be confining • ARM binaries on x86 machine? • Windows applications on Linux? MacIntosh apps Windows apps. MacOS Linux x86 x86 7
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 e(S i ) S i S j Guest V( S i ) V( S j ) e '(S i ') S i ' S j ' Host 10
Virtualization vs. Abstraction • Virtualization does not necessarily hide details virtualization file file 11
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 of a computer system • Implementation: embodiment of the architecture 14
Computer Architecture Application • Computer systems Programs consist of: Libraries • Layers of abstraction Operating System • Well-defined interfaces Execution Hardware Memory Translation System Interconnect (bus) I/O devices Main and Memory Networking 15
The ISA Interface Application • Interface between Programs hardware & software Libraries • Two parts Operating System • System ISA Execution Hardware • User ISA Memory Translation System Interconnect (bus) I/O devices Main and Memory Networking 16
The ISA Interface Application • System ISA Programs • Important for OS Libraries developers Operating System Execution Hardware Memory Translation System Interconnect (bus) I/O devices Main and Memory Networking 17
The ABI Interface Application • Application Binary Programs Interface (ABI) Libraries • User ISA + system calls Operating System • Important for compiler writers Execution Hardware Memory Translation System Interconnect (bus) I/O devices Main and Memory Networking 18
The API Interface Application • Application Programs Programming Libraries Interface (API) Operating System • User ISA + library calls • Important for Execution Hardware Memory application Translation System Interconnect programmers (bus) I/O devices Main and Memory Networking 19
Major Program Interfaces • ISA – supports all conventional software Application Software System Calls Operating System System ISA User ISA ISA • ABI – supports application software only Application Software System Calls Operating System System ISA User ISA ABI 20
Process Virtual Machines • Supports an individual process • Run SW for a different OS and different ISA • Couple at ABI level via runtime system Application Process Guest Application Process Runtime Virtualizing Software Virtual OS Machine Host Machine Hardware 21
Process Virtual Machines • Guest processes intermingle guest host with host processes process process • Binaries encapsulated by runtime the runtime guest guest • PVM does not include OS host process process process • Examples: runtime runtime create • Java • IA-32 EL HOST OS • Dynamic optimizers file sharing (dynamo) Disk network communication 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 HLL Program HLL Program Compiler front-end Compiler Intermediate Code Portable Code ( Virtual ISA ) Compiler back-end VM loader Object Code ( ISA ) Virt. Mem. Image VM Interpreter/Translator Loader Memory Image Host Instructions HLL VM Traditional 26
PVM: High-Level Language VMs • Distribution format is binary class files • Virtualized ISA (no real implementation) • OS interaction via API • Examples: Java, Micosoft CLI Java Binary Classes Java VM Architecture VM VM VM implementation implementation implementation Apple Sparc x86 Mac Workstation PC 27
System Virtual Machines • Supports an OS with many user-level processes • Couple at the ISA level • Examples: VMWare, Transmeta Crusoe Applications Applications Guest OS OS Virtualizing VMM Software Virtual Machine Hardware Host "Machine" 28
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 Win Win Win Linux Linux Linux process process process process process process Guest OS2 (Linux) Guest OS (Windows) VMM HOST PLATFORM virtual network communication 29
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
Recommend
More recommend