210 likes | 468 Views
Virtual Machine - Introduction. Virtual machine systems: simulators for multiple copies of a machine on itself. Virtual machine (VM): the simulated machine. Virtual machine monitor (VMM): the simulator software. Pure software simulator is too slow; Direct hardware execution is necessary
E N D
Virtual Machine - Introduction • Virtual machine systems: simulators for multiple copies of a machine on itself. • Virtual machine (VM): the simulated machine. • Virtual machine monitor (VMM): the simulator software. • Pure software simulator is too slow; Direct hardware execution is necessary • Complicated when OS involved; especially with multiple OS; build separate VMM layer CDA6159fa07 peir
Virtual Machine - Introduction • Principal characteristics of the original (IBM 360) architectures for which virtual machine systems were developed was the dual-state hardware organization with a privileged and non-privileged mode. • Privileged software nucleus (kernel) • Extended machine: set of non-privileged instructions together with the supervisory calls. • VMM runs on privileged mode, while guest OS runs on non-privileged mode CDA6159fa07 peir
The Renaissance of Virtualization- X86 Prospective from VMware • 1970s: Virtual machines first used • 1990s: • x86 becomes prominent server platform, not design for virtualization • No vertical integration in x86 • Lack of enterprise features in commodity OSs • 1999: VMWare first product to virtualize x86 • 2006: AMD and Intel offer hardware support CDA6159fa07 peir
Virtual Machine - Performance • Extra resources needed: main memory, processor cycles. • Sources of overhead: • Maintaining the status of the virtual processor. • Support of privileged instructions. • Support of paging within virtual machines. • Console functions. • A problem: resource allocation algorithms in operating system (these are meant for managing real resources, but the virtual resources may not correspond precisely to real resources). CDA6159fa07 peir
Virtual Machine - Applications • Privileged software development, test and diagnostic functions, multiple operating system execution concurrently with production uses of the system. • Retrofit old operating systems with new features. • Improved testing of privileged software. • Testing of computer network software on a single physical machine. • Debugging and performance monitoring tools. • Software reliability through isolation. • Data security. CDA6159fa07 peir
Hardware / Software Interface 3: “system” ISA: I/O, memory mgmt, CPU intercept & emulate 4: “user” ISA: ALU, branch, load/store direct execution
Basic VM Architecture • Classic VMs are enabled by “Virtual Machine Monitor” (VMM) software – VMM may be in total control of the underline physical machine • No O/S below the VMM – Or, VMM may share the physical machine with a “host” operating system • VMM runs on top of host O/S (with user-level processes, as well as with kernel code, e.g. modules) CDA6159fa07 peir
VMM Integrated with Host OS • Advantages: • Simple to install VMM, hosted OS accommodate rich I/O devices, take advantage hosted OS’ resource management • Disadvantages: • Performance overhead, no performance isolation
Fundamental task of VM monitor • Present a “replica” of the interfaces to Hardware • provided by physical machine to each VM – Interface to processor (i.e. instruction set) – Interface to memory (i.e. use physical memory addresses) – Interface to I/O devices (e.g. memory mapped I/O, interruptions) * Different views of physical I/O device possible; e.g. a SCSI physical disk may be viewed as many virtual IDE disks CDA6159fa07 peir
VMM – Processor Virtualization • Analogy with operating systems: – Most application instructions execute directly on processor (O/S does not see them) – Those that require access to shared resources are handled indirectly by calling the O/S via system calls • VMM: – Most application instructions execute directly on processor (VMM does not see them) – Those that require privileged processor access are handled indirectly – they are trapped and emulated by the VMM CDA6159fa07 peir
Challenges and Techniques • X86 architecture is not designed for virtualization • POPF (pop CPU flags from stack) set / clear interrupt-disable flag; does not trap in user mode in guest OS • Paravirtualization • Replace nonvirtualizable instructions with virtualized equivalent • OS must be ported in order to run in a virtual machine • Disco (for MIPS) changes MIPS interrupt flag from a privileged register to a special memory location
VMM - Memory Virtualization • Aided by processor’s ability to support virtual memory • One more level of indirection is implemented – O/S: application loads/stores virtual address; map to physical addresses of physical machine – Classic VM: application loads/stores virtual address; map to physical address of the VM; then map to physical address of physical machine CDA6159fa07 peir
VMM - I/O Virtualization • Hosted versus non-hosted – Non-hosted: VMM must implement drivers for each device Since it interfaces directly with hardware; must go through VMM, incur overhead – Hosted: VMM may build on top of existing device drivers of host O/S • E.g. VMware: low-level I/O accesses to virtual disk are mapped into accesses to a regular file of the host via system calls • Host O/S drivers, in turn, maps to I/O accesses to physical disk