Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hypervisors and java virtual machine

The questions I would like to ask are:

1) What exactly does hypervisor do? Why is it needed?

2) What is the difference between hypervisor and Java Virtual mMchine?

3) Does JVM use a hypervisor?

4) When a host operating system like linux can handle multiple guest operating system,why use hypervisor?

Would be great help if someone shed light on this

like image 570
Vindhya G Avatar asked Jan 11 '13 06:01

Vindhya G


Video Answer


3 Answers

  1. A Hypervisor also known as hardware virtualization are a virtualization layer that allows running one or more native operating system on top of it, as if they run on a physical machine. It is similar to emulation but only runs operating systems that would be able to run without the Hyperviser, which are much faster.

  2. Both are virtualization layers. However Java are optimized for performance and portability. While Java are technicaly an emulator, it are much faster than an hyperviser. This can be achieved because the emulated platform are designed for fast emulation. Java do not run x86 or x86_64/amd64 code, it runs something called Bytecode. The technical term for Bytecode are Intermediate Language (IL). It are compiled to code that are native to your processor when you run it, by the Just In Time compiler (JIT). As the JIT do a compilation process it can make sure that the program follows Java:s security constraints, by simply not generating code that violates such constraints. The Hyperviser enforce security constraints by intercepting so called privileged instructions and by emulating devices such as disk drives. This are done because native x86 or x86_64/amd64 code are very hard for a program to understand, and changing it so that it self-enforce security constraints are next to impossible. Java on the other hand runs Bytecode which are easy for a program to understand and chance so that it self-enforce security rules.

The short answer: An hyperviser are slower than Java but allows you to run a multitude of complete operating systems, and all the software available for them. This while Java are faster, but you can only run Java software on it. If you want to run Windows and Office in your virtual machine, you can't do that in Java.

  1. I think I answered this above but no, it use code inspection and modifies the program so that it self-enforce security rules. This can be done because runnable Java application are in a intermediate state called Bytecode, which are easy for Java to understand, inspect, find code that may violate the rules and modify it in order to obey them. This are a rather complex process that have several advantage over hypervisor. The first advantage are "compile once run everywhere", as Java are compiled and distributed as bytecode. The second advantage are speed, JIT:ed code have the same speed as non-virtualized code even when strict security are enforced. The disadvantage are that only Bytecode programs can run, so you for example cannot run Windows or Linux inside the virtual machine.

  2. If you are running another operating system like Windows or another Linux distribution - you are running an Hyperviser. KVM, Xen and VirtualBox are examples of Hypervisors. You can also run multiple instances of Linux with one shared kernel, known as OS-based virtualization or "Container". But a Container share the kernel and therefor you can only virtual machines with the OS you are running. The advantage with Containers it are more lightweight as you do not need to run multiple kernels on top of each other...

like image 74
user1657170 Avatar answered Nov 29 '22 00:11

user1657170


Before answering your questions, I would recommend you search related entries in wikipedia. A hypervisor is used to run multiple guest OSes while JVM is used to interpret java byte code. JVM runs on top of OS and it doesn't care whether the OS runs on top of bare metal or on a hypervisor. Actually, linux can handle multiple guest operating systems with KVM which is part of the linux kernel. So the description of the last question is totally wrong.

like image 22
Jeff Li Avatar answered Nov 29 '22 00:11

Jeff Li


  1. Hypervisor or virtual machine manager, is a program that allows multiple operating systems to share a single hardware host.
  2. JVM or Java Virtual Machine interprets bytecode for a computers processor so that it can perform Java program instructions.
  3. No JVM does not use hypervisor as it is not an virtual machine that runs an OS rather it is just a interpreter.
  4. A host operating system manages different VMs using Hypervisor or virtual machine manager
like image 28
HHH Avatar answered Nov 29 '22 01:11

HHH