Presentation is loading. Please wait.

Presentation is loading. Please wait.

Virtual Machines What Why How Powerpoint?. What is a Virtual Machine? A Piece of software that emulates hardware.  Might emulate the I/O devices  Might.

Similar presentations


Presentation on theme: "Virtual Machines What Why How Powerpoint?. What is a Virtual Machine? A Piece of software that emulates hardware.  Might emulate the I/O devices  Might."— Presentation transcript:

1 Virtual Machines What Why How Powerpoint?

2 What is a Virtual Machine? A Piece of software that emulates hardware.  Might emulate the I/O devices  Might emulate the CPU  Might be very high fidelity emulation  Might cheat

3 Different from an O.S. An OS has system calls.  To write to the serial port, you call write(...)‏ A VM fakes hardware.  To write to the serial port, you copy bytes and trigger interrupts.

4 Operating Systems and Virtual Machines Operating Systems can run on real hardware. Operating Systems can run on fake hardware (virtual hardware). Lots of Oss can run on the same real machine. If the VM is good, the OS cannot tell.  Timing issues  Performance (good or bad)‏

5 Uses of a Virtual Machine Pretend to be a non-existent machine (prototyping)‏ Multitask lots of virtual machines on one physical machine (web servers). Emulate any machine or network  Atari  Parallels  Vmware's Teams

6 Examples of Virtual Machines VMware  Has many Linux/Windows boxes running on one. Parallels  Has a Windows OS running under MacOS VM  Has many applications running on a mainframe.

7 How to Make a Virtual Machine Take over the CPU into supervisor mode. Mark a bunch of memory regions protected  Interrupt table, devices, page tables Start running the OS code  On the real CPU in non-supervisor mode  On a fake CPU if need be CPU is different CPU is non-virtualizeable

8 What if it's the Wrong CPU You can always fake the CPU  Read the instruction  Do what it would do  Repeat  Suffer a 5x to 20x performance hit

9 Reading/Writing to the Serial Port Writing  OS writes to a device register  VM gets an interrupt, fakes the write Reading  VM gets an interrupt.  VM fakes an interrupt to the OS.

10 Serial Port (Continued)‏ Efficiency  Stinks Virtualizability  Can have more serial ports than exist  Can redirect serial ports to anything else (USB?)‏

11 Virtualizing Video Framebuffer Frame Buffer  Mark every page is r/o  When OS writes, VM gets an interrupt and writes HUGE slowdown

12 Virtualizing a Modern Video Card OS makes a command list OS writes to a register on the video card to trigger the graphics processor unit. VM gets an interrupt VM rewrites the command list if needed VM sends the (new) commands to the video card.

13 Virtualizing Graphics With a Fake Device Driver Make a device driver that does not actually drive a device, but instead communicates with the VM. Have the VM receive these messages and execute the instructions. SPEED!!!!

14 Virtualizing RAM OS has a page table stored in ram it thinks it owns. VM has really marked that as read-only. When the OS makes a change, the VM gets an interrupt and reflects the change to the real page table.

15 RAM in a Virtual Machine No sharing between guess OSs. No way for an OS to make RAM as unneeded. NO way to change the allocation of RAM between Vms on the fly.

16 CPU in a Virtual Machine Each guest OS gets the CPU a fixed amount If a guest OS is idle... CPU is wasted

17 File Systems in a Virtual Machine Each guest OS has it's own fake disk drive. Each fake disk drive is typically a file on the host. Yes, this is lots of disk space.

18 Cheating in a VM It's called a performance enhancement :-)‏ Since Window's data structures are well known, and it's possible to write a windows device driver...  Vmware can share identical RAM pages  Vmware can harvest free RAM  Vmware can harvest idle CPU  Vmware has a vmware file system

19 Xen Basic Idea:  Don't emulate a real machine, that's too hard and slow.  Edit each guest OS to communicate with the host (paravirtualization). Implications  better performance, easier implementation  Can no longer run unmodified Oss

20 Xen (again)‏ Xen has code inside Windows (non-published) and Linux. Xen (starting at 3.0) can also do straight virtualization for a few Oss (like Windows). Best??? of both worlds. Also supports live migration  Only a 300 ms delay

21 Performance If you need to fake the CPU  performance is like 5-10% of real time. If your application is I/O intensive  performance can suffer If you application is CPU intensive  performance is better If you are emulating an Atari 2600(tm)‏  Your performance is better than real time.

22 Performance (again)‏ Dr. Dobbs says  CPU performance hit is < 10%  Ram hit is “costs ~200M”  http://www.ddj.com/hpc-high-performance- computing/199000664;jsessionid=BSCMYJRQRF5 VSQSNDLRSKHSCJUNN2JVN?pgno=3 http://www.ddj.com/hpc-high-performance- computing/199000664;jsessionid=BSCMYJRQRF5 VSQSNDLRSKHSCJUNN2JVN?pgno=3

23 Crazy Nested VM-itude Can you run a VM inside a VM?  depends Should you run a VM inside a VM  maybe not How deep can you go  typically, either zero or infinity

24 Other Uses of VMs Since any guest can be a file...  Ship it across country  Pause and restart  Clone thousands  Debug


Download ppt "Virtual Machines What Why How Powerpoint?. What is a Virtual Machine? A Piece of software that emulates hardware.  Might emulate the I/O devices  Might."

Similar presentations


Ads by Google