JVM

As we all know that Java is high-level programming language and the program which is written in high level language cannot run directly on any machine. First it need to convert into that specific machine language. The Java compiler does this thing, it takes java program (.java document containing source code) and makes an interpretation of it into machine code (alluded to as byte code or .class record).

Java Virtual Machine (JVM) is a virtual machine that lives in the genuine machine (your PC) and the machine language for JVM is byte code. This makes it simpler for the compiler as it needs to create byte code for JVM instead of various machine code for each kind of machine. JVM executes the byte code created by the compiler and produce output. JVM makes java platform independent.

In this way, presently we comprehended that the essential capacity of JVM is to execute the byte code delivered by the compiler. Each working framework has distinctive JVM, anyway the yield they produce after the execution of byte code is the same overall working frameworks. Which implies that the byte code produced on Windows can be a sudden spike in demand for Mac OS and the other way around.

JVM
JVM Architecture
JVM
Working of JVM
Class Loader:

Class loader reads the .class file and save byte code in method area.

Method Area:

In JVM there is only one method area which is common with all the classes. It holds the class level information of one by one .class file.

Heap:

It is a part of JVM memory where objects are allocated. For each .class file JVM creates class object.

Stack:

In Java stack, it is used to store temporary variable or we can also say it store frames.

PC(program counter) Registers:

It keeps the address of JVM instruction has been executed.

Native Method Stack:

It contain and access the native methods used in application.

Native Method Interface:

It empowers java code to call or be called by local applications. Local applications are programs that are explicit to the equipment and OS of a framework.

Garbage collection:

A class occasion is expressly made by the java code and after use, it is naturally wrecked by trash assortment for memory the executives.

Difference between JVM vs JRE vs JDK
JRE:

JRE is the environment inside which the java virtual machine runs. JRE contains Java Virtual Machine(JVM), class libraries, and different records barring improvement apparatuses, for example, compiler and debugger.

Which implies you can run the code in JRE yet you can’t create and assemble the code in JRE.

JVM:

As we talked about above, JVM shows the program to utilizing class, libraries and documents gave by JRE.

JDK:

JDK is a superset of JRE, it contains all that JRE has alongside improvement instruments, for example, compiler, debugger and so on.

Copyright 1999- Ducat Creative, All rights reserved.