Internal Architecture of JVM




Internal Architecture of JVM

There is a main 4 part of Internal Architecture of JVM
·         Class Loader Sub System
·         Runtime Data Area
·         Execution Engine
·         Java Native Interface
·         Native Method Libraries




Figure of Internal Architecture of JVM

Class Loader Sub System: - Java’s dynamic class loading functionality is handled by the Class Loader Subsystem. It loads, links and initializes the class when it refers to a class for the first time.
Class Loader Subsystem is responsible for following 3 activities

·         Loading 
·         Linking
·         Initialization


Runtime Data Area: - During execution of program JVM allocates memory. Some Runtime data areas are specific to thread only. Following is list of different Runtime Data Areas:-

1.      Method Area
2.      Heap
3.      Stack
4.      Pc Register
5.      Native Stack

Method Area – All the class level data will be stored here, including static variables. There is only one method area per JVM, and it is a shared resource.
Heap Area – All the Objects and their corresponding instance variables and arrays will be stored here. There is also one Heap Area per JVM. Since the Method and Heap areas share memory for multiple threads, the data stored is not thread safe.
Stack Area – For every thread, a separate runtime stack will be created. For every method call, one entry will be made in the stack memory which is called as Stack Frame. All local variables will be created in the stack memory. The stack area is thread safe since it is not a shared resource. The Stack Frame is divided into three sub entities:
    1. Local Variable Array – Related to the method how many local variables are involved and the corresponding values will be stored here.
    2. Operand stack – If any intermediate operation is required to perform, operand stack acts as runtime workspace to perform the operation.
    3. Frame data – All symbols corresponding to the method is stored here. In the case of any exception, the catch block information will be maintained in the frame data.
PC (program counter) Registers – Each thread will have separate PC Registers, to hold the address of current executing instruction once the instruction is executed the PC register will be updated with the next instruction.

Native Method stacks – Native Method Stack holds native method information. For every thread, a separate native method stack will be created.


Execution Engine –
It contains:
  • ·         A virtual processor
  • ·         Interpreter: Read byte-code stream then execute the instructions.
  • ·         Just-In-Time (JIT) compiler: It is used to improve the performance. JIT compiles parts of the byte code that have similar functionality at the same time, and hence reduces the amount of time needed for compilation. Here the term? Compiler? Refers to a translator from the instruction set of a Java virtual machine (JVM) to the instruction set of a specific CPU


NOTE- For any query or problem please contact us on- thesoultioncity@gmail.com
Message us on over Whatsapp Number:-   9532126715



Other Theory Topics:-

No comments:

Post a Comment