DEV Community

Cover image for What is Java Virtual Machine (JVM)
Sachin kumar singh
Sachin kumar singh

Posted on

What is Java Virtual Machine (JVM)

This is the second tutorial of java programming for beginners series, and in this tutorial we are briefly discuss about java virtual machine's working and functionalities and why it is important.

The Heart of java programming

You may also called the jvm as the heart of java programming.
JVM is responsible for making java protable and universal.

JVM working

Step1.

First of all .java file or programme is converted into .class file consisting of byte code instruction by the java compiler.The java compiler remains outside of the jvm.

step2

Now .class file is given to the jvm. Jvm consist of a module called class loader sub system that performs the below functionalities

  1. The class loader sub system loads the .class file into memory

  2. Then it verifies whether all byte code instructions are proper or not. If it finds any instruction suspicious the eecution is rejected immediately.

  3. If the byte instruction are proper,then it assign necessary
    memory to execute the programme.

Note

This memory is didvided into various parts mention below

1.Method area

This memory block stores the class code, code of the methods in java programme and variables.

2.Heap

This is the area where objects are created.

3. Pc registers

This registers contain memory address of the insturctions of the methods. if there are 5 methods, 5 pc regiters will be used to trac the instruction of the methods.

This is the breif and short discussion on Java virutal machine(jvm)
stay tuned for our next tutorial on java
to know more about jvm visit official java documentations.

Top comments (0)