开发者

Is the JVM, a form of VM?

I am a mainly .NET developer and I do a lot of infrastructure work with techs like ESX and Hyper-V. I find it very odd that the JVM has VM in it (I keep thinking of VMs in the form that sits on an ESX server).

开发者_C百科

Am I correct in saying that the JVM is an actual VM sitting in a certain ring between the OS and apps (not between hardware and OS)?

Thanks


It's a virtual machine in the same way that the CLR (part of .NET) is a virtual machine. It's not quite the same as a Hyper-V type VM though... Hyper-V virtualizes common hardware to run an entire operating system so that most code "thinks" it's really running directly on a normal computer.

The JVM or CLR are slightly different in that:

  • The instruction set being virtualised has been designed specifically to be virtualised. While there is some "native Java bytecode" hardware, that's far from the normal way of running Java. Normally bytecode and IL are JIT-compiled - and the garbage collector is part of the virutal machine, which certainly isn't the case in Hyper-V etc.
  • The VM doesn't run an operating system itself - it runs on an operating system which it knows about directly, and uses for file system access etc

Both kinds of "virtual machine" are running code in a virtual environment, but the primary concerns of the two are very different.


The Java (and .NET, and Python, and Parrot...) virtual machine is a "simulated computer." It has instructions and behaviors which are identical across the operating systems the VM runs on, which makes the "cross-platform" aspect work. The VM itself is platform-specific, of course, to iron out the details for the client code.

So yes, everything back to the Infocom Z-Machine and Knuth's MIX virtual machine are, in fact, "virtual machines."


Wrong virtual machine.


While ESX and Hyper-V emulate a computer system,a JVM only provides execution (and optimization) of java byte code on a supported platform.


Yes, the JVM takes Bytecode and executes it, and it is able to enforce security restrictions on the application.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜