Search code examples
javaoperating-systemvirtual-machinevirtualization

Can someone explain what virtual machines are and why they're useful?


I hear the term thrown around a lot and I'm sort of confused.

  • Is it just a software application built on an operating system that could simulate another operating system?

  • When someone codes a virtual machine, do they basically set out to make an operating system but instead of accessing hardware directly they just call the appropriate trap instructions they would need to? But then you wouldn't be able to simulate certain protected actions like interrupts, right?

  • Aside from me being able to remotely connect to and run a Linux desktop from within windows, are there any other reasons this might be useful?

  • What's a "virtual machine monitor"?

  • What is the point of the Java Virtual Machine, why not just do what other languages do?

Cheers


Solution

  • There are lots of questions there, I will just set out to explain my experiences with virtual machines.

    They are a great way to test code or applications on different OS versions, i.e. vista vs windows 7 or different versions of android, 2.3 vs 4.0 for instance.

    They are also a great way of keeping your main desktop computer clean. Perhaps I want to install some beta software, or a beta OS, and I don't want to make my main machine unstable. I can install windows 8 preview and muck around with it, and trash it later on. Windows 8 preview wouldn't be stable enough to be my main machine, but I may need to evaluate it.

    I can also make a virtual machine and take a snapshot. This means if I want to test an application I can rollback to the snapshot so that I know the exact state of the machine when I am testing the application.

    Virtual machine monitor is an application where I can view the current state of all my virtual machines. Perhaps I am running a production system with multiple live servers running. If they are web servers they could each run in a virtual machine. Virtual machine monitor is where I can view how much CPU they are each using. Increase the memory, add servers, remove servers, install new servers, etc.

    Virtual machines are great in a live situation like this because you can clone then, increase the memory, decrease the memory, add more servers, etc and these operations can all be done quite easily.