-->
Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Friday, July 14, 2017

JVM Architecture

 How JVM Works

Byte-Code Execution
After .java file has been passed through javac compiler, a .class file containing Byte-code is generated with same file name.This '.class' goes through several steps which are performed by JVM or Java Virtual Machine
 
Functions of Class Loader
Loading
Linking
Initialization



Loading: -The Java Classloader is a part of the Java Runtime Environment(JRE) that dynamically loads Java classes into the Java Virtual Machine(JVM)

Linking:-Linking performs three important task: 
Verification,Preparation,Resolution
  
Verification:-
  • It makes sure that .class file or interface generated after compilation is structurally correct.If verification fail then we get an run time error java.lang.VerifyError
  • Verification may cause other classes and interface to be added but they need not be verified and prepared.
  • Final class methods/class, abstract class/methods are checked in this stage.
Preparation:-
  • In this stage memory is allocated to the class variables and default value is assigned.
  • Initialization to other values other than default value is done if explicit initializers are executed.
Resolution:-
  • In this process the symbolic references from the constant pool is replaced with direct references.
  • Implementations may delay the resolution till each symbolic reference is used by the program while running


Java Virtual Machine has three types of Class Loaders
Bootstrap class loader
Extensions class loader
➤ System class loader 

Bootstrap class loader:- Bootstrap class loader is capable of loading trusted classes. It loads core java API classes. This path is popularly known as bootstrap path. It is written in native languages like C/C++.

Extensions class loader:- It is child of bootstrap class loader.The Extension class loader loads the classes from the JRE’s extension directories, such lib/ext directories or any other directory specified by the java.ext.dirs system property. It is implemented in java by the sun.misc.Launcher$ExtClassLoader class

System class loader:- It is child of extension class loader.The System class loader loads the classes from the application class path, which are set by the CLASSPATH environment variable.
It is also implemented in Java by the sun.misc.Launcher$ExtClassLoader class.

No comments:

Post a Comment