Strong Processes

In a recent Healthcare Technology Report article, the FDA is reported as once again raising concerns about medical device shortages and the importance of visibility in the medical device supply…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Java Virtual Machine and its Architecture

Java Virtual Machine

The JVM can be simply known as the engine that provides a runtime environment for Java and its applications. The JVM is considered to be a part of the JRE (Java Runtime Environment). Its commonly and famously known for its process of converting java code to bytecode and then interpreting the bytecode into machine language.

Java applications are also known as “write once run anywhere” as a Java code can be written in one system and is able to run in many Java-enabled systems without any changes made with the help of the JVM.

The Java JVM is platform-dependent (Mac JVM, Linux JVM, Windows JVM) whereas the Java code is platform independent.

The internal architecture of the JVM can be broken down into 3 main parts namely,

· Memory Area

· Execution Engine

This is considered as a subsystem of JVM and it is responsible for loading the class files when a program is run.

· Bootstrap ClassLoader

· Extension ClassLoader

· System/Application ClassLoader

These perform three main functions.

Loading

The class loader reads the .class file and generates the required binary data which is stored in the method area. It also stores details like,

· the fully qualified name of the loaded class and its immediate parent class.

· Variables, modifiers, and method information.

Linking

This is where all the verifications, preparations, and resolutions are done. The verification process ensures the correctness of the file.

Preparation is the process of the JVM allocating memory for class variables and assigning default values in the memory.

Resolution is the process of converting symbolic references to direct references. This is done by going through the method area to locate the referenced entity. However, this function is optional

Initialization

Here all static variables and blocks are assigned with values mentioned in the code. This code is executed from top to bottom hierarchy.

The JVM memory main consists of the following sectors,

· Method Area

· PC Register

· Native Method Stack

Method Area

Heap

All the information related to Objects is stored here. This memory is also common and therefore shared among multiple threads.

Stacks

PC Register

Also known as the program count register holds the current address of the JVM instruction currently being executed.

Native Method Stack

This holds all the native methods used in the application as implied by the name.

This executes the .class file by reading the byte code line by line, using its data and information present in various memory areas, and executes instructions. It can be further broken down into 3 parts,

· Interpreter

This interprets the code line by line and executes, however, if one method is called multiple times it has the interpreted again and this can be considered as a disadvantage of it.

· Just-In-Time Compiler (JIT)

This is used as a remedy for the above problem where this increases the efficiency of the interpreter by compiling the entire byte code and changing it to native code, so when there is a repeat method call the JIT compiler will provide the native code for that part so that a re-interpretation is not needed.

· Garbage collector

This is used to destroy or get rid of un-referenced Objects.

Add a comment

Related posts:

Online shopping dominates the consumer market

Over the past 10 years, online shopping has become the new normal for purchasing everything from books to niche products to even groceries. Since 1994, Amazon has been adding to their catalog of…

Goal Setting

Stop over-complicating things, it is very simple to do whatever you want to do. Write down your goal, then work to achieve that goal. Maybe you’ll realize new goals in the process, write those down —…

How to Win Friends?

All of you have probably read or heard about this famous book “How to Win Friends and Influence People” from the famous Author “Dale Carnegie”. As the name depicts, it is clear that this book is all…