Virtual Pc Seminar


Published on

Published in: Technology
  • please send this ppt to
    Are you sure you want to  Yes  No
    Your message goes here
  • please send this ppt tp
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Virtual Pc Seminar

    1. 1. Virtual PC Welcome ! By PIYUSH .R. CHORDIA TE (Div. - I) Sinhgad College of Engineering Seminar Guide Prof.C.A.Laulkar
    2. 2. Agenda <ul><li>Virtual PC </li></ul><ul><ul><li>Architecture </li></ul></ul><ul><ul><li>Features </li></ul></ul><ul><ul><li>Terms & Concepts </li></ul></ul><ul><ul><li>Scenarios </li></ul></ul><ul><ul><li>Demo </li></ul></ul>
    3. 3. Solution Accelerators
    4. 4. Why Virtualization ? <ul><li>40 % per year </li></ul><ul><li>30 % per year </li></ul>
    5. 5. Virtualization <ul><li>Virtualization is a framework or methodology of dividing the resources of a computer into multiple execution environments, by applying one or more concepts or technologies such as : </li></ul><ul><ul><li>hardware and software partitioning, </li></ul></ul><ul><ul><li>time-sharing, </li></ul></ul><ul><ul><li>partial or complete machine simulation, </li></ul></ul><ul><ul><li>emulation, </li></ul></ul><ul><ul><li>quality of service and many others </li></ul></ul>
    6. 6. Virtual PC Normal PC Operation Application Software Operating System Hardware Device Drivers
    7. 7. Virtual PC Architecture PC Virtualization Host Operating System Host Drivers Host Hardware Virtualized Hardware Guest Drivers Guest Applications Guest Operating System Virtual PC Guest Environment Host Environment
    8. 8. How does Virtual PC work Architecture Virtual PC Disk file Software Hardware Virtual Machine config in vmc-file CPU0 CPU1 Sound Diskette CD/DVD Ports USB Network host driver CPU Mem Disk VPC host driver host driver host driver VPC .iso .vfd VMM
    9. 9. Virtual Machine Monitors (VMMs) <ul><li>VMM is a layer of system software </li></ul><ul><ul><li>Enables multiple VMs to share platform hardware </li></ul></ul><ul><ul><li>Allows Apps to run without modifications </li></ul></ul>... Virtual Machine Monitor (VMM) VM n VM 0 VM 1 Platform HW I/O Devices Processor/CS Memory Virtual Machines (VMs) App n App 0 Guest OS 0 App 1 Guest OS 1 Guest OS n
    10. 10. VMM Arrangements Host OS VMM Guest 1 Guest 2 VMM Guest 1 Guest 2 Host OS VMM Guest 1 Guest 2 Type-2 VMM Type-1 VMM (Hypervisor) Hybrid VMM Examples: JVM CLR Examples: Virtual PC & Virtual Server Examples: Windows Virtualization Hardware Hardware Hardware What we have today What we’re building for the future
    11. 11. IA System Virtualization Today Physical Memory I/O Devices Logical Processors Virtual Machine Monitor (VMM) Virtual Machines Binary Translation Paravirtualization Page-table Shadowing IO-Device Emulation Interrupt Virtualization DMA Remap IA-based System Virtualization Today Requires Frequent VMM Software Intervention
    12. 12. The Hypervisor CPU Hard Drive Ethernet NIC RAM <ul><li>Thin layer of software running on the hardware </li></ul><ul><li>Supports creation of partitions </li></ul><ul><ul><li>Each partition is a virtual machine </li></ul></ul><ul><ul><li>Each partition has one or more virtual processors </li></ul></ul><ul><ul><li>Partitions can own or share hardware resources </li></ul></ul><ul><ul><li>Software running in partition is called a guest </li></ul></ul><ul><li>Enforces memory access rules </li></ul><ul><li>Enforces policy for CPU usage </li></ul><ul><ul><li>Virtual processors are scheduled on real processors </li></ul></ul><ul><li>Enforces ownership of other devices </li></ul><ul><li>Provides simple inter-partition messaging </li></ul><ul><ul><li>Messages appear as interrupts </li></ul></ul><ul><li>Exposes simple programmatic interface called “hypercalls” </li></ul>Hypervisor Parent Partition
    13. 13. Device I/O Accesses <ul><li>I/O accesses (IN & OUT instructions) </li></ul><ul><li>Trap into VMM kernel </li></ul><ul><li>Force a context switch back to the host context where device emulation module is invoked </li></ul><ul><li>“ Fast I/O handlers” can be called from within the VMM context </li></ul><ul><li>Some OUTs can be batched </li></ul><ul><li>MMIO accesses </li></ul><ul><li>Caught in VMM’s page fault handler </li></ul><ul><li>Very expensive </li></ul>Host Kernel Host Physical Machine Virtual PC VMM Kernel Host context Guest context Guest User Code Guest Kernel Guest HAL Host HAL 3 0 0 0 1 1 3 VMM Driver Device Emulation Module OUT instr. GPF trap Context Switch
    14. 14. VM Components <ul><li>VMM Kernel </li></ul><ul><ul><li>Thin layer, all in assembly </li></ul></ul><ul><ul><li>Code executed at ring-0 </li></ul></ul><ul><ul><li>Exception handling </li></ul></ul><ul><ul><li>External Interrupt pass-through </li></ul></ul><ul><ul><li>Page table maintenance </li></ul></ul><ul><ul><li>Located within a 32MB area of address space known as the “VMM work area” </li></ul></ul><ul><ul><li>Work area is relocatable </li></ul></ul><ul><ul><li>One VMM instance per virtual processor </li></ul></ul>Host Physical Machine VMM Kernel Host context Guest Context Guest Code VMM Driver NDIS Driver Host Kernel Virtual PC Virtual Server Virtual Machine “ Additions ”
    15. 15. VM Components <ul><li>VMM Driver </li></ul><ul><li>Provides kernel-level VM-related services </li></ul><ul><ul><li>Create Virtual Machine </li></ul></ul><ul><ul><li>Create Virtual Processor </li></ul></ul><ul><ul><li>Execute Virtual Processor </li></ul></ul><ul><li>Implements context switching mechanism between the host and guest contexts </li></ul><ul><li>Loads and bootstraps the VMM kernel </li></ul><ul><li>Much of the security work we’ve done recently involved repackaging the VMM kernel code into the VMM driver </li></ul>Host Kernel Host Physical Machine VMM Kernel Host context Guest context Guest Code VMM Driver NDIS Driver Virtual PC Virtual Server Virtual Machine “ Additions”
    16. 16. VM Execution Loop <ul><li>Host code repeatedly calls ExecuteVirtualProcessor </li></ul><ul><li>VMM acts as “co-routine” (i.e. VMM state is saved and restored each time ExecuteVirtualProcessor is called) </li></ul><ul><li>Cycles spent inside guest context are counted against the calling thread </li></ul><ul><ul><li>Host code can control how much time is spent in guest </li></ul></ul><ul><li>Return code indicates why ExecuteVirtualProcessor returned </li></ul><ul><ul><li>Time slice complete </li></ul></ul><ul><ul><li>IN or OUT instruction encountered </li></ul></ul><ul><ul><li>HLT instruction encountered </li></ul></ul>
    17. 17. Virtualized Hardware <ul><li>Memory (up to 4 GB) </li></ul><ul><li>Virtual Hard Disks </li></ul><ul><ul><li>(3 VHD – upto 16 GB/vhd) </li></ul></ul><ul><li>CD/DVD drive </li></ul><ul><li>Floppy drive </li></ul><ul><li>Serial ports (COM1, COM2) </li></ul><ul><li>Paralell port (LPT1) </li></ul><ul><li>Networking (4 NICs) </li></ul><ul><li>Sound </li></ul><ul><li>Display </li></ul><ul><li>No USB support </li></ul>
    18. 18. Terms The ability to drag files or folders between the virtual machine and the host Drag and Drop The ability to use a folder on the host as a mapped drive letter in the virtual machine Shared Folders Virtual Machine Configuration (VMC) file is where all the settings for a virtual machine are stored VMC Virtual Hard Disk (VHD) is the file on the physical computer that a virtual machine uses as a hard disk and perform all the reads and writes VHD A CDROM implemented in software that can share the physical computer CDROM or access ISO images Virtual CDROM Software loaded on the guest operating system that provided increased functionality and performance enhancements Virtual Machine Additions A network created in software Virtual network The Operating software that is installed on the virtual machine Guest OS The actual hardware that is being used and where Virtual PC 2004 is installed Physical Computer The operating system that is installed on the physical computer Host OS The virtual hardware environment provided by Virtual PC 2004 Virtual Machine Description Term
    19. 19. Extended Page Tables (EPT) <ul><li>A VMM must protect host physical memory </li></ul><ul><ul><li>Multiple guest operating systems share the same host physical memory </li></ul></ul><ul><ul><li>VMM typically implements protections through “page-table shadowing” in software </li></ul></ul><ul><li>Page-table shadowing accounts for a large portion of virtualization overheads </li></ul>Goal of EPT is to reduce these overheads
    20. 20. What Is EPT? <ul><li>E xtended P age T able </li></ul><ul><li>A new page-table structure, under the control of the VMM </li></ul><ul><ul><li>Defines mapping between guest- and host-physical addresses </li></ul></ul><ul><ul><li>EPT base pointer (new VMCS field) points to the EPT page tables </li></ul></ul><ul><ul><li>EPT (optionally) activated on VM entry, deactivated on VM exit </li></ul></ul><ul><li>Guest has full control over its own IA-32 page tables </li></ul><ul><ul><li>No VM exits due to guest page faults, INVLPG, or CR3 changes </li></ul></ul>Guest IA-32 Page Tables Guest Linear Address Guest Physical Address Extended Page Tables Host Physical Address EPT Base Pointer (EPTP) CR3
    21. 21. EPT Translation: Details <ul><li>All guest-physical memory addresses go through EPT tables </li></ul><ul><ul><li>(CR3, PDE, PTE, etc.) </li></ul></ul><ul><li>Above example is for 2-level table for 32-bit address space </li></ul><ul><ul><li>Translation possible for other page-table formats (e.g., PAE) </li></ul></ul>
    22. 22. Direct Execution <ul><li>In some processor modes, it’s safe to use direct execution, others require emulation </li></ul>Emulation, unless known to be safe Protected Mode Ring 0 Direct Execution (with a few exceptions) Protected Mode Ring 3 Direct Execution Virtual 8086 (v86) mode Emulation Real Mode
    23. 23. Direct Execution <ul><li>“ Ring Compression” </li></ul><ul><ul><li>Guest ring-0, 1, 2 code is executed at ring 1 </li></ul></ul><ul><ul><li>Guest ring-3 code is executed at ring 3 </li></ul></ul><ul><ul><li>Provides correct MMU protection semantics (since ring 0-2 can access privileged pages) </li></ul></ul><ul><li>Direct execution of ring-0 code is only allowed if the VMM is notified that it’s “safe” </li></ul><ul><ul><li>This requires patching certain “dangerous” instruction sequences in the Windows kernel and HAL </li></ul></ul><ul><ul><li>Patching is performed at runtime in memory only </li></ul></ul><ul><ul><li>Patches are different for each version of Windows kernel & HAL </li></ul></ul>
    24. 24. Guest OS Patching <ul><li>Runtime Guest OS Patching </li></ul><ul><ul><li>Replace synthetic instructions with subroutine calls </li></ul></ul><ul><ul><li>This technique prevents us from exposing internal VMM implementation details to OS vendors. We can change the subroutine implementations in the future. </li></ul></ul>pushfd cli mov eax,[ebp+8] call [eax] popfd ret vmpushfd vmcli mov eax,[ebp+8] call [eax] vmpopf ret Original Code With Synthetic Instructions call _vmpushfd call _vmcli mov eax,[ebp+8] call [eax] call _vmpopfd ret With Runtime Patches This patched sequence is correct and fast
    25. 25. Emulated Hardware Same as host CPU Intel 440BX Chipset DEC/Intel 21140A (10/100) Network adapter (multi-function) S3 Trio 32/64 PCI with 8 MB Video RAM Video card Virtual machine emulated hardware Component Creative Labs Sound Blaster 16 ISA Plug and Play Soundcard AMI BIOS using Intel 440BX rev B chipset BIOS
    26. 26. Virtual Disks <ul><li>Types of virtual disks </li></ul><ul><ul><li>Dynamically expanding virtual disk </li></ul></ul><ul><ul><li>Fixed virtual disk </li></ul></ul><ul><ul><li>Differencing </li></ul></ul><ul><ul><li>Linked drive - use a host partition </li></ul></ul><ul><li>Default is dynamic – 16GB </li></ul><ul><ul><li>35KB when created on disk, expands as you write data to it </li></ul></ul><ul><li>Use Virtual Disk Wizard to pre-create other disk types </li></ul>
    27. 27. Undo Disks <ul><li>Allows all changes from power-on to be saved, committed or discarded </li></ul><ul><ul><li>Reboots are not affected </li></ul></ul><ul><li>Enabled per virtual machine, applies to all disks </li></ul><ul><li>Writes are made to a separate undo file per disk </li></ul>
    28. 28. Virtual Machine States <ul><li>Running states </li></ul><ul><ul><li>Pause </li></ul></ul><ul><ul><li>Save State </li></ul></ul><ul><ul><li>Turn off </li></ul></ul><ul><ul><li>Shutdown the Guest OS </li></ul></ul><ul><li>Undo disks add these states </li></ul><ul><ul><li>Save State and save changes </li></ul></ul><ul><ul><li>Save State and commit changes </li></ul></ul><ul><ul><li>Turn off and Save changes </li></ul></ul><ul><ul><li>Turn off and discard changes </li></ul></ul>
    29. 29. Virtual PC Features Benefits and Usage Scenarios <ul><li>Ease application migration </li></ul><ul><ul><li>Run older legacy applications while migrating to a new operating system </li></ul></ul><ul><ul><li>Pilot and test new operating systems in a controlled, fail-safe environment </li></ul></ul><ul><li>Technical support </li></ul><ul><ul><li>Support multiple operating systems on a single computer without rebooting the computer or buying additional computers </li></ul></ul><ul><ul><li>Set up numerous user-specific configurations on a single computer for real-time scenario testing and evaluation </li></ul></ul><ul><li>Training </li></ul><ul><ul><li>Train people on any operating system without purchasing additional computers </li></ul></ul><ul><ul><li>Dramatically reduce classroom turnaround time by instantly switching configurations </li></ul></ul><ul><ul><li>Restore students’ crashed operating systems with a mouse-click </li></ul></ul>
    30. 30. Virtual PC Features Benefits and Usage Scenarios <ul><li>Quality Assurance </li></ul><ul><ul><li>Test and document software on different operating systems on one computer </li></ul></ul><ul><ul><li>Compare application look and feel in multiple environments simultaneously </li></ul></ul><ul><ul><li>Test potentially unstable prerelease software in a safe, isolated environment </li></ul></ul><ul><li>Accelerate application development </li></ul><ul><ul><li>Increase QA by testing on multiple OSs using VMs </li></ul></ul><ul><ul><li>Decrease time-to-market with less reconfiguration </li></ul></ul><ul><li>Do more in less time </li></ul><ul><ul><li>Run multiple OSs on a single physical computer </li></ul></ul><ul><ul><li>Reduces the number of physical computers needed </li></ul></ul>
    31. 31. Virtual PC Features Key Features <ul><li>Configurability </li></ul><ul><ul><li>Adjust settings and allocate resources </li></ul></ul><ul><li>Easy installation </li></ul><ul><ul><li>No reboot required </li></ul></ul><ul><li>Standardization </li></ul><ul><ul><li>Avoid hardware conflicts </li></ul></ul><ul><li>Convenience </li></ul><ul><ul><li>Switch between OSs as easily as any application </li></ul></ul><ul><li>Host integration </li></ul><ul><ul><li>Drag and drop between guest and host </li></ul></ul>
    32. 32. Virtual PC Features Using Virtual Machines
    33. 33. Virtual Networking <ul><li>Up to 4 NICs per virtual machine </li></ul><ul><li>Network Modes </li></ul><ul><ul><li>Not Connected </li></ul></ul><ul><ul><li>Local Only (virtual machines only) </li></ul></ul><ul><ul><ul><li>VM communicates with other VMs on the Local Only network </li></ul></ul></ul><ul><ul><li>External NIC (Virtual Networking) </li></ul></ul><ul><ul><ul><li>Each VM appears to be a separate entity on the network </li></ul></ul></ul><ul><li>Use a MS Loopback adapter to get internal only traffic between host and virtual machine </li></ul>
    34. 34. Networking Virtual Networking vs Local only Virtual Machine #1 Virtual Machine #2 Virtual Network Host NIC External Ethernet
    35. 35. Networking Virtual Machine Virtual PC Translators Network Address Translator Server Host TCP/IP Connection
    36. 36. Virtual Machine Additions <ul><li>Improved operating system performance </li></ul><ul><li>Drag and drop </li></ul><ul><li>Clipboard sharing </li></ul><ul><li>Shared folders </li></ul><ul><li>Integrated mouse </li></ul><ul><li>DOS CD-Rom support </li></ul><ul><li>Optimized video drivers </li></ul><ul><li>Time synchronization </li></ul><ul><li>Dynamic resizing of VM window </li></ul>
    37. 38. Today’s Uses Virtualization addresses today’s IT concerns 10:1 in many cases Enables rapid deployment Server Consolidation Test and Development VM1 HW VMM HWn … HW0 VM1 VMn OS App OS App … HW VM1 VMn VMM OS App OS App OS App OS App
    38. 39. Virtualization Capabilities Workload Isolation Workload Migration Workload Embedding HW App 2 App 1 OS HW 1 HW 2 App 2 App 1 OS 1 OS 2 VMM HW App 2 App 1 OS 1 OS 2 VMM HW 1 App HW 2 VMM OS VMM HW 1 App HW 2 VMM OS VMM HW App App OS 1 OS 2 VMM HW App 1 App 2 OS OS Virtualization has powerful capabilities Workload Consolidation
    39. 40. Virtualization Today Summary Of Challenges <ul><li>Complexity </li></ul><ul><ul><li>CPU virtualization requires binary translation or paravirtualization </li></ul></ul><ul><ul><li>Must emulate I/O devices in software </li></ul></ul><ul><li>Functionality </li></ul><ul><ul><li>Paravirtualization may limit supported guest OSes </li></ul></ul><ul><ul><li>Guest OSes “see” only simulated platform and I/O devices </li></ul></ul><ul><li>Reliability and Security </li></ul><ul><ul><li>I/O device drivers run as part of host OS or hypervisor </li></ul></ul><ul><ul><li>No protection from errant DMA that can corrupt memory </li></ul></ul><ul><li>Performance </li></ul><ul><ul><li>Overheads of address translation in software </li></ul></ul><ul><ul><li>Extra memory required (e.g., translated code, shadow tables) </li></ul></ul>
    40. 41. <ul><li>Create a new VM </li></ul><ul><li>Review Virtual PC settings </li></ul><ul><li>Launch a VM </li></ul>