Java Virtual Machine(JVM) Architecture :
Every Java program have extension as .java, when we compile
a java program (.java file), the compiler will generate .class file containing
byte code instructions
.java
(java code or source code)
compiler------Ã
.class (byte code)
The byte code that is generating by compiler can be executed
on any machine with the help of JVM.
The JVM will take the .class file as the input and executes
the program
The sub system will take the .class file which is generated
by the compiler as the input and performance the following tasks.
- It will load the .class file into the JVM
- Before loading the .class file ,it will verify whether the byte code is valid or not ,verification is done by the byte code verifier
- If the byte code is valid, then memory will allocated for the byte in different memory areas.
- The various memory allocations which are used for storing the byte code are called Runtime Date Area.
- The various runtime data areas are:
Method Area: This area can be used for storing all the class code
and method code
Heap: This area can be used for storing all the objects of the program.
Java Stack: This area can be used for storing all the methods that are
under execution.
The
Java stack can be consider as a collection of stack frames where each frame
will contain the state (information) of a single method
PC Register (Program counter): This Register will contain the
address of the next instruction to executed
Java
Native stack: [Non java code –Native stack] -: This stack is used for storing
the Non java code. The Non java code is called as Native code.
Execution Engine: The execution engine
is responsible for executing the byte code stored in different runtime data
areas.
The Execution Engine contains Two Parts:
- Interpreter
- JIT Compiler (Just-in-time compiler) [Given by Host pot Technologies]
Both Interpreter and JIT compiler
will execute the code parallel. Which will improve the performance of the application
by executing the code faster.
[**Note]: The code that is executed by the JIT compiler will
be called as hot spots.
Native Interface: This interface will help to load the native
code into the JVM .which is required for the program
Native Libraries:
It is a collection of predefined program
of other languages.
OS(operating system):
To execute the java program , the JVM
requires some resource from the machine
.To get the resource from the machine
,the JVM has to Communicate
with the operating system .
0 Comments