JVM Architecture 01

Anuradha Gunasinghe
2 min readMay 13, 2021

--

what is JVM

JVM (Java Virtual Machine) is an abstract machine. It is a completely specification that provides runtime environment. JVM comes with the JRE when you install the JRE it will deploy all the code which can create a JVM. It’s take care read class file convert that to the language which your operating system can understand.

JVM Architecture

jvm architecture

How Does the JVM Work?

The JVM architecture is divided into three major partitions

  • Class Loader
  • Memory Area
  • Execution Engine

1 Class Loader

The Java Class Loader loads the classes into the JVM. All virtual machines include one Class Loader which is embedded into the virtual machines. Class loader is divide into three partition:

Loading

Linking

Initialization

1.1 Loading

Take class file and put in to the memory is the major task of Class Loader. Class loader has 4 major rules:

It read full qualified class name
Whether is class, enum or interface
It’s read about variable information
It’s read about immediate parent information

1.2 Linking

Linking involves in verifying and preparing a loaded class or interface. Linking divided in 3 stages as:

verification
preparation
resolution

Verification

ensure the correctness of .class file. (whether check valid compiler, whether class file correct formatting, whether correct structure according to JVM specifications.) If verification fails, it throws runtime exception

preparation
allocate memory for static storage and any data structures used by the JVM such as method tables. Static fields are created and initialized to their default values, however, no initializers or code is executed at this stage as that happens as part of initialization.

Resolution

replace symbolic references from the type with direct references. It is done by searching into method area to locate the referenced entity.

1.3 Initialization
This is the final phase of class loading where all the static variables are assigned with their original values defined in the code and the static block will be executed. This is executed line by line from top to bottom in a class and from parent to child in class hierarchy.

continue with next : Memory Area

--

--

Anuradha Gunasinghe
Anuradha Gunasinghe

Written by Anuradha Gunasinghe

Senior Software Engineer @ CCI Computer Global, Bachelor of Engineering (BEng) Honours in Software Engineering Graduated from University of Westminster

No responses yet