Java virtual machine is a specification that provides an environment for runtime in java bytecode which can be executed. JVM is platform-dependent.
In this article, we will understand the internal architecture of a java virtual machine.
ClassLoader
- It is a subsystem that loads class files.
- Whenever the java program is run, class files are loaded first by the classloader.
Bootstrap Classloader: This is the first classloader superclass of the extension class loader.
Extension ClassLoader: We can call this the child classloader and parent of the system class loader. it loads jar files inside $JAVA_HOME/jre/lib/ext.
App ClassLoader: We can call this child of extension classloader.Loads class files from classpath.
Class Area:
Class Area stores runtime constant pool structure and field, method data, and code for methods.
Heap:
Responsible for runtime data area in which objects are allocated.
Stack:
Responsible for method invocation and return and holds local variable and partial results.
Program Counter Register:
Contains the address of JVM instructions currently executed.
Native Method Stack:
Contains all native methods in the app.
Execution Engine:
It contains Virtualprocessor, interpreter, and JIT compiler(Just In Time), which is used to improve performance.
JNI:
JNI or java native interface is a framework that provides an interface for communication with apps written in different languages.
- Log in to post comments