JVM Architecture

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 3

JVM Architecture

_______________________________________________________________________________

Q. What is JVM?
JVM stands for Java Virtual Machine it is application which is used for load the class file generated by
compiler and perform different operation on it like as allocate memory for object, verify byte code or
perform garbage collection on objects etc
Now we want to discuss about JVM Architecture

Class Loader: class loader is subsystem of JVM and it is mainly responsible for following activities
1. Loading
2. Linking
3. Initialization

Loading: the class loader reads the .class file by compiler, generate the corresponding binary data or
machine code and save it in method area.
JVM store the following information in method area
1. The fully qualified name of the loaded classes and its immediate parent may be interface class or
enum
2. Store information about modifier, variables and method information etc.
after loading .class file create object of type of Class in heap memory.

Linking: Linking perform verification, preparation etc

Verification: it ensures that correctness of .class i.e cross verify .class generated by valid compiler means
check its version and everything is there if .class file not generate property we get run time error.
.class file verification done by component name as ByteCodeVerifier. Once this activity is completed
then the class file is ready for loading.

Preparation: Preparation means JVM allocate memory for static variables and initialize the default
values.
Initialization: in this phase, all static variables are assigned with their default values define in the code
and static block if any and this executed from top to bottom

There are three types of class loader


_______________________________________________________________________
Bootstrap class loader: Every JVM implementation must have bootstrap class loader it is used for
loading trusted classes, load core JAVA API from path JAVA/jre/lib this path known as bootstrap path.

Extension class loader: it is child of bootstrap class loader it is used for load class present in
JAVA/jre/ext package
System/Application class loader: it is responsible for load classes from application path means used
project.

JVM memory
_______________________________________________________
Method Area: In the method area all class level information like class name, immediate parent name ,
method name variable name , access modifier details including static method etc

Heap Area: information of all objects is stored in the heap area.


Stack Area: stack area maintain thread information means internally every thread has one stack so stack
executed simultaneously by JVM waiting of each other.
PC Register: store address of current execution thread and every thread has different address.

Native method stacks: native stack means every thread has special stack called as native method stack
and thread can store information it

Execution engine: this is used for execute the .class file means read byte code line by line and uses data
and information present in different memory area and execute the code.
There is some stages perform in execution engine.
1. Interpreter: interpreter interprets bye code line by line and then executes. the disadvantages is that
when one method is called multiple times every time interpretation is required.
2. Just in time: it is used for increase the efficiently of an interpreter it compile the entire byte code and
changes it to native code so whenever the interpreter see repetated method call JIT provide direct
native code for that part

3. Garbage Collector: it is used for destroy un-referenced objects or release the objects from memory
those never use in future

Native method interface: it is an interface that interacts with native method libraries and provides the
native libraries (C,C++) required for the execution. It enable JVM to call C/C++ libraries and within may
be specified hardware
Native Method library: It is a collection of the native libraries (C,C++) which are required by the
execution engine.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy