Skip to main content

What is JVM.?How its Works.?

Hello friends
I am Kushal Bhatt
And I am welcome you on my another content on our blog CompuTech.
In this blog we are discuss on JVM and JRE.
So lets start our today's topic.
It's not necessary to know internal works of JVM and it not having connection to java code programming but if you want to make deep knowledge related to java then you can find it here and it can be helpful to solve a problem which is unsolvable.

1. What is JVM.?
JVM stands for Java Virtual Machine.
It is also called a Abstract Computer or Virtual Computer.
JVM us essential part of Java.
Normally all language compiler are translate source code to machine code for a specific computer .
Java compiler is also done those things with slightly different way.
You are already know the java is both compiler and interpreter language.
So once java compiler convert your source code to not machine code  but it convert into byte code.
This byte code are not understandable by computer as well as human.
In practical way, when you compile your   *.java file in cmd compiler create a  *.class file which is a byte code file as the place where .java file exist.
This byte code file hand over to java JVM for further processing.
Now actual JVM work is begin,
Now this byte code are not understandable to computer so we need to make it convert into machine code which is understandable by computer and run it.
JVM has many responsibility to do like to check user are use which operating system and hardware config. And JVM is convert that byte code to machine code according to user OS and hardware for fulfill Platform Independent.
This machine code actually generated by java interpreter which is exist in JVM this java Interpreter is different for different OS.
JVM is exist only inside the computer memory and does all major function of real computer.
Java provide a virtual memory to code and handle byte code to make more efficiently fulfill machine dependent approach.
Once compiler compile  *.java file then it generate byte code file means *.class file is run on any machine or any OS .
So we can say that JVM is provide a interface between OS and Hardware for processing output.
Now we are understand Internal Work of JVM...
When compiler handover byte code to JVM .
JVM has to perform  many function  concurrently like,
Class Loader.
Memory Management .
Execution Engine.

1.Class Loader.
Class Loader used to load Byte code to data areas for execution.
First of all it need to linking with correct file to load classes of generated byte code .
When class Loader receive a request of loading class then it need to check or verify to Cache for see class is loaded or not.
If not then it give to Bootstrap class Loader  which is parent class and work is to load all core libraries for machine code generating.
If If parent class is not suppose to able to load class then it requesting to child class Loader is Extension class Loader. It is used to load extension classes libraries.
Extension class loader is child of Bootstrap class loader.
If this child class is not able to load all class then it request to System Class Loader which is child of Extension class loader. And it is used to load all Application classes libraries.
If this also not able to load all class then it requesting last child class of System class Loader is User Defined Class Loader.it is used to load all user defined classes for machine code generation process.
Now after successfully loaded all classes we need to intialize and  execute all command of Byte code.
2. Memory Management.
There are many things are to help a managing memory .
Method area is used to store a class code which is method code and used to create static variables.

Heap Area.
It is used to store a object of a classes contain in byte code to be execute.
It is also main memory of JVM .
This memory area is very flexible.
It can expandable depend on object size.
Heap and Method both have shared Memory .
PC Register is used to store a address of next instruction to be execute for generating machine code.
Native Method area store a all non java classes and methods.
Garbage Collector is most import thing in memory management .
It is used to automatic clear up memory when ever requiring .
It is invoke automatically when it decide to release memory area.

3. Execution Engine.

Execution Engine execute a program in two part.

->Interpretion
->JIT(Just In Time)compiler.

Interpretion is used to execute and change each and every command from byte code to machine code.

JIT Compiler is used to execute that command and convert into .machine code.
Both JIT and Interpretion are work concurrently which is reduce execution time and provide High Performance .

JNI it is Java Native Libraries is used to provide a Native Methods And Classes  Libraries like C and C++ codes to use in java because java can support Native Methods.

JVM is also handle the threads to perform on time or not in correct way.


This blog is all about a information of internal use of JVM please share and comment for suggestion.
See you to next time.

For more useful article
Reason of invention of java real time use of java click here.

Feature of java.
https://computech18.blogspot.in/2017/11/features-of-java-for-beginners.html

Comments

Popular posts from this blog

Difference between C and Java ,C++ and Java

Hello Friends I am Kushal Bhatt. And I am welcome you on our blog CompuTech with another topic. Today's topic is Differ ence between C and Java ,C++ and Java. First we discuss Difference bet ween C and Java. 1 . C was develop by Dennie Ritchie at AT&T Bell Labs between 1969 to 1973, On other hand Java was develop by James Gosling at sun Microsystems which first appear in 1995. 2. C is Procedural Ori ented Programming langu age On other hand Java is Object Oriented Programming language . 3. C is Low level langu age On other hand Java is High level lang uage. 4. C is Compi le lang uage On other hand Java is Interpreter Langua ge. 5. C follow Top Bottom approach. on other hand Java follow Bottom Top approach. 6. C contains the Preprocessor Directives header file like #include,#define. On other hand Java not contains any header file. 7 . C support Goto statement, Structure,union but Java not support Goto statement, Stru...

Features of java for beginners

Hello friends I am kushal bhatt And I am welcome you on my another post on java subject in our blog CompuTech. Today We need to discuss the key features provided by java . So lets start our todays topic Java is very high level programming language and its also support oops concepts that make it more better. There are list of features provide by java 1.Simple and Familier 2.Object Oriented. 3.Robust and Secure. 4.Plateform Independent and portable. 5.Compiled and Interpreter. 6.Distributed. 7.Multithreading and Interactive 8.High Perfomance. 9.Dynamic and Extensive. 1. Simple and Familier: -             Java are not use some of features such as Operator overloading,Multiple Inheritence,Goto statement , pointer, Preprocessor Directive and many more features which is helpful to reduce complexity of program. Java is quite similar to C and C++ even though Java syntax similar to C and C++. So it is easy to unde...

Basic Introduction of Java for beginners

Hello Friends I am kushal bhatt and I am welcome you on our very first  blog CompuTech . Friends, you all are already aware about a Java Programming Language like how to write a code how to compile and run it but i am here to discus about . Why Java was invented. Which requirement fulfilled by Java and Nowadays Where actually java is used in a real time . So it is very required for your career to clear basic fundamental of java . So lets start our todays topics☕ First of all we need to clear what is actual java is? Java is a System friendly High level programming language that means java can easily interact with system. Java is a pure Object Oriented Programming language because everything in java must be object or class . History :- Java was Developed by James Gosling at sun microsystems in 1990  and after couple of years it acquire by Oracle corporation till now. Sun microsystem actually want to develop a language that can easily work with e...