1. Class Loader Subsystem
Java’s dynamic class loads, links and initializes the class when it refers to a class for the first time at runtime, not at compile-time. It performs three major functionality such as Loading, Linking, and Initialization.
1.1 Loading
BootStrap ClassLoader
Extension ClassLoader
Application ClassLoader
1.2 Linking
Verify Prepare Resolve
1.3 Initialization
This is the final phase of Class Loading, here all static variable will be assigned with the original values and static block will be executed.
2. Runtime Data Area
1.Method Area – All the Class level data will be stored here including static variables. Method Area is one per JVM and it is a shared resource.
2. Heap Area – All the Objects and its corresponding instance variables and arrays will be stored here. Heap Area is also one per JVM since Method area and Heap area shares memory for multiple threads the data stored is not thread safe.
3.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. Stack area is thread safe since it is not a shared resource. Stack Frame is divided into three sub-entities such as
4.Local Variable Array – Related to the method how many local variables are involved and the corresponding values will be stored here.
5.Operand stack – If any intermediate operation is required to perform, operand stack act as runtime workspace to perform the operation.
6.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.
7.PC Registers – Each thread will have separate PC Registers, to hold address of current executing instruction once the instruction is executed the PC register will be updated with the next instruction
8.Native Method stacks – Native Method Stack holds native method information. For every thread, separate native method stack will be created.
3. Execution Engine
1.Interpreter
2.JIT Compiler
1)Intermediate Code generator – produces intermediate code
2)Code Optimizer – Code Optimizer is responsible for optimizing the intermediate code generated above
3)Target Code Generator – Target Code Generator is responsible for Generating Machine Code/ Native Code
Profiler – Profiler is a special component, it is responsible for finding the hotspots (i.e) Used to identify whether the method is called multiple time or not.
3.Garbage Collector