The java virtual machine(JVM) is an abstraction of subsystems and memory areas. below is the diagram represents the JVM architecture.
The class loader sub-sytem is basically a part of the java runtime environment mechanism that dynamically load fully qualified types, classes and interfaces. The class loader is responsible for locating the libraries , reading the contents and loading the classes on demand. The fully qualified class is loaded only once by a given class loader. There are various class loader
- Bootstrap class loader : The bootstrap class loader is written in native code and responsible for loading all the classes in "JAVA_HOME/jre/lib" directory.
- Extension class loader : This class loader loads the all the code in the "JAVA_HOME/jre/lib/ext" directory or any other directory specified by "java.ext.dirs" system property.
- System class loader : This class loader loads all the components/ code found in the java class path.
Execution Engine
The Execution engine is responsible for executing the instruction present in the loaded classes. It comprises of the JIT(just in time) compiler and Garbage collector.
- JIT(Just in Time Compiler) : The just in time compiler is responsible for converting the byte code to CPU understandable code dynamically. The JIT is based on dynamic compilation and byte code compilation.
- Garbage Collector : The Garbage Collector in java is a form of automatic memory management. Its is responsible for cleaning old objects and reclaiming the memory. We will look into the details in upcoming post.
Method area and heap area
Each instance of the JVM has a method area and a heap area. When the JVM loads a class its reads the binary data from the class file and types and stores it in a the method area. As the program execution starts its stores the object instantiated on to the heap. This areas are shared by all the threads running inside the java virtual machine.
Java Threads/Stacks and the PC registers
When ever a java thread runs inside the java virtual machine its has its own PC registers and stack for the execution. The state of the execution of a thread executing a method is stored on the stack and the course of instruction set in the PC registers. The local variable and parameters are stored on a stack for the thread.
No comments:
Post a Comment