Core java tutorial for beginners
A tutorial blog which explains different core concepts related to Java along with programming examples
Subscribe to Startertutorials.com's YouTube channel for different tutorial and lecture videos.

Categories: Core Java Basics. 1 Comment on Java Virtual Machine

In this article we will look at Java Virtual Machine (JVM) which provides the run-time engine for bytecode generated by the Java compiler. We will look at JVM architecture and more.

 

Introduction

 

Before learning about JVM it is important to know about JDK (Java Development Kit) and JRE (Java Runtime Environment). Below figure shows the relationship between JDK, JRE, and JVM:

 

jvm_jre_jdk

 

JDK provides programmers with a set of tools (like javac, debugger, javap, appletviewer etc..) for developing Java programs. JDK includes JRE.

 

JRE provides the run-time engine JVM along with the class libraries which contains the predefined functionality.

 

Using JDK programmers can create and run Java programs. But with JRE alone, programmers or users can only run already compiled Java programs. We cannot create Java programs using only JRE.

 

Java Virtual Machine (JVM) is an abstract computing machine that allows a computer to run programs written in Java. There are three concepts related to JVM:

  • Specification
  • Implementation
  • Instance

 

The JVM specification is a document which contains formal information about what a JVM implementation should contain. A single specification allows various interoperable implementations.

 

A JVM implementation is a computer program that meets the requirements given in JVM specification.

 

An instance of a JVM is an implementation running in a process that executes bytecode. Oracle’s implementation of JVM specification is known as HotSpot. Other famous implementations are JRockit, Kaffe, IBM J9.

 

Overview of the architecture of JVM is as shown below:

 

java-virtual-machine

 

Class Loader

 

A class loader implementation is a program that should be able to perform the following activities:

  • Loading: finds and imports the binary data for a type
  • Linking: performs verification, preparation, and resolution (optional)
  • Initialization: Invokes Java code that initializes class variables to their proper initial values

 

Heap

 

The heap area of JVM is used for dynamic memory allocation. In HotSpot the heap is divided into generations:

  • The young generation stores objects whose lifetime is short.
  • The old generation stores objects which persist for longer durations.

 

The permanent generation area stores class definitions and other metadata. This area is removed in Java 8.

 

More information about Java Virtual Machine can be found here.

How useful was this post?

Click on a star to rate it!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Suryateja Pericherla

Suryateja Pericherla, at present is a Research Scholar (full-time Ph.D.) in the Dept. of Computer Science & Systems Engineering at Andhra University, Visakhapatnam. Previously worked as an Associate Professor in the Dept. of CSE at Vishnu Institute of Technology, India.

He has 11+ years of teaching experience and is an individual researcher whose research interests are Cloud Computing, Internet of Things, Computer Security, Network Security and Blockchain.

He is a member of professional societies like IEEE, ACM, CSI and ISCA. He published several research papers which are indexed by SCIE, WoS, Scopus, Springer and others.

Note: Do you have a question on this article or have a suggestion to make this article better? You can ask or suggest us by filling in the below form. After commenting, your comment will be held for moderation and will be published in 24-48 hrs.

1 Comment

You can follow any responses to this entry through the RSS 2.0 feed.

How does Oracle’s HotSpot JVM implementation differ from other JVM implementations like JRockit and IBM J9?

Leave a Reply

Your email address will not be published. Required fields are marked *