JVM
Architecture
The
internal architecture of the JVM is as below:-
1) Class loader:- It loads the .class file into the memory. Then it verifies all the class code and if it finds any suspicious, then the execution is rejected.
2) Class
(Method) Area:-It stores all the class code ,code of variables and methods and also
all static variables are created in this area.
3)
Heap:-It stores all the Objects.
4) Java
Thread/Stack:-As we know that method code is stored in method area but while
executing the method to store intermediate results it uses stack. Java uses separate
thread to execute each method.
A new
frame is created each time a method is executed destroyed when its method execution
is completes.
5)
Program Counter Register:-PC (program counter) register contains the address of the Java
virtual machine instruction currently being executed. If there are 3 methods
executing then there will be 3 PC registers maintained.
6)
Native Method Stack:-Like Java methods execute in java stack, similarly all the native
methods execute in native method stack. Example for Native lib is C, C++
functions. The native method lib is connected to JVM through a program called
Native method interface.
7)
Execution Engine:-
It
contains of below components:-
|
1) Interpreter
|
2) Just-In-Time(JIT) compiler
|
The java code is executed by both interpreter and JIT compiler
simultaneously so that the execution time is reduced and performance is
increased. The code that is executed by JIT compiler is called as HOTSPOTS
(company).
No comments:
Post a Comment