JVM Internals
Last updated
Last updated
Class loader sub system
JVM's class loader sub system performs 3 tasks
It loads .class
file into memory.
It verifies byte code instructions.
It allots memory required for the program.
Run time data area
This is the memory resource used by JVM and it is divided into 5 parts
Method area
Method area stores class code and method code. (metaspace in Java SE 8)
Heap
Objects are created on heap.
Java stacks
Java stacks are the places where the Java methods are executed. A Java stack contains frames. On each frame, a separate method is executed.
Program counter registers
The program counter registers stores memory address of the current instruction to be executed by the micro processor for a stack. PC register count is equal to Java stacks.
Native method stacks
The native method stacks are places where native methods (for example, C language programs) are executed. Native method is a function, which is written in another language other than Java.
Native method interface
Native method interface is a program that connects native methods libraries (C header files) with JVM for executing native methods.
Native method library
This holds the native libraries information.
Execution engine
Execution engine contains interpreter which converts byte code into machine code. JVM uses optimization technique to decide which part to be interpreted and which part to be used with JIT compiler. The HotSpot profiler represent the block of code executed by JIT compiler.