What is JVM??

Thilini Weerasinghe
2 min readApr 29, 2021

JVM stands for Java Virtual Machine. As it mentioned in the name, it was a type of a virtual machine. The term virtual means it is not exist physically, but it simulate the real environment. When install the JRE(Java Runtime Environment) for the particular Operating System, it deploy the all the necessary code that needs to create a program called JVM. As we cannot install the JVM physically to the machine, it works as a virtual machine.

Virtual Machine has major two types.

  1. System based Virtual Machine (SVM)
  2. Application based Virtual Machine (AVM)

In system based virtual machine, it use one/same hardware for creating different multiple environment. Hypervisor and Xen are the example for that. Hypervisor use computer memory, hard disk, CPU, network and other hardware resources to create multiple VM according to their particular requirements and specification. It creates a same physical host system to deploy different types of OS such as Linux, Windows.

Application based virtual machine not like SVM, it is a kind of software application that creates platforms to run another software. No hardware involvement in there. JVM, PVM and CLR are some example for that. Now you can understand that the JVM is kind of AVM that enable to run java programs.

So, what are the main functions of the JVM???

The answer is, JVM is a specification that explains how the things to be done in according to run a java program. When we write a java program and execute it, at that moment JVM creates JVM instance and that JVM instance is responsible for converting the bytecode into machine code.

The next question is, Is the JVM instance always in your computer???

The answer is no. If you are not execute or run any java program in your machine, at that particular time frame there is no any JVM instance in your computer. It means JVM instance only available if and only if we are executing a java program.

Last question is, What are the ways that JVM can get destroyed???

Actually there are two ways that the JVM can be destroyed. They are,

  1. If there is no any non-demand thread exist on the machine, then the JVM instance is destroyed. It means all the created non-demand thread were finished their execution already. So there is no point in available JVM instance.
  2. Next way is a java program can stop the execution of the program calling exit(); method by itself. After the executing exit() method there is no any java program available and JVM instance is destroyed at that time.

Hope, you will get some basic information about the JVM and I’ll discuss about the structure of the JVM in next article…..

Stay Safe & learning new things!!!!

--

--

Thilini Weerasinghe

Currently working as an Associate Software Engineer at Virtusa. Has completed degree in B.Sc (Hons) Computing & Information Systems. After all I am a Human...