5

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

Kara
  • 6,115
  • 16
  • 50
  • 57
JDS
  • 16,388
  • 47
  • 161
  • 224
  • 1
    http://en.wikipedia.org/wiki/Virtual_machine ; your question (list of questions in fact) is too broad. ("Why not do what other languages do?" - quite a lot of languages use virtual machines of one form or another.) – Mat May 22 '12 at 04:44

4 Answers4

4

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.

peter
  • 13,009
  • 22
  • 82
  • 142
2

From Wiki:

A virtual machine (VM) is a "completely isolated guest operating system installation within a normal host operating system".Modern virtual machines are implemented with either software emulation or hardware virtualization or (in most cases) both together.

Check this for more.

Jay
  • 24,173
  • 25
  • 93
  • 141
2

Java Virtual Machine and a Virtual Machine are two completely different things.

  • A Java virtual machine (JVM) is a virtual machine that can execute Java bytecode.
  • A virtual machine (VM) is a "completely isolated guest operating system installation within a normal host operating system"

Virtual Machines do catch interrupts and act exactly like your computer would. In a developer-oriented perspective they are very useful to test and debug for different OS's. In a server-environment they are great for virtualization of a single mainframe.

Java Virtual Machines (JVM) serve the purpose of interpreting Java bytecode. Java is "compiled" into an intermediary state and JVM runs it on the host machine in a completely transparent way for the developer.

Frankie
  • 24,627
  • 10
  • 79
  • 121
  • Yes I am explaining there about virtual machines, but Java Virtual Machine is totally different. You are quite correct. – peter May 22 '12 at 04:48
  • @peter don't put much effort into the answer as this question is probably going down. Nevertheless the OP clearly asks (and mixes) VM's and JVM's so I thought that stating that there is a HUGE difference would be appropriate. – Frankie May 22 '12 at 04:50
  • OK fair enough. Don't have anything better to do today. – peter May 22 '12 at 04:52
1

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

It is a software simulation of a hardware platform, built upon 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?

Yes and no. Hardware support is often provided for virtualization. See, for instance: x86 virtualization - Hardware support

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?

Lots of reasons.

  • Testing has already been mentioned.
  • You've mentioned the ability to run a different OS within the host OS.
  • The ability to make snapshots of the running state of a VM.
  • The ability to start/stop/pause a running VM.

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

Platform-independence.

pb2q
  • 58,613
  • 19
  • 146
  • 147