Sunday 27, Apr 2025
We are moved to new domain
Click -> www.ehowtonow.com
Sunday, 1 October 2017

Introduction to Java Virtual Machine (JVM)

What is JVM

A Java virtual machine (JVM) is an abstract computing machine that enables a computer to run a Java program.

There are three notions of the JVM:
1. Specification
2. Implementation
3. Instance.
The specification is a document that formally describes what is required of a JVM implementation. Having a single specification ensures all implementations are inter-operable. A JVM implementation is a computer program that meets the requirements of the JVM specification. An instance of a JVM is an implementation running in a process that executes a computer program compiled into Java bytecode.

Java Runtime Environment (JRE)

Java Runtime Environment (JRE) is a software package that contains what is required to run a Java program. It includes a Java Virtual Machine implementation together with an implementation of the Java Class Library. The Oracle Corporation, which owns the Java trademark, distributes a Java Runtime environment with their Java Virtual Machine called HotSpot.

Java Development Kit (JDK)

Java Development Kit (JDK) is a superset of a JRE and contains tools for Java programmers, e.g. a javac compiler. The Java Development Kit is provided free of charge either by Oracle Corporation directly, or by the OpenJDK open source project, which is governed by Oracle.

What JVM does

The JVM performs following operation:

  • Loads code
  • Verifies code
  • Executes code
  • Provides runtime environment

JVM provides definitions for the:

  • Memory area
  • Class file format
  • Register set
  • Garbage-collected heap
  • Fatal error reporting etc.

Java Virtual Machine Architecture


1. Classloader : Classloader is a subsystem of JVM that is used to load class files.

2. Class(Method) Area : Class(Method) Area stores per-class structures such as the runtime constant pool, field and method data, the code for methods.

3. Heap : It is the runtime data area in which objects are allocated.

4. Stack : Java Stack stores frames.It holds local variables and partial results, and plays a part in method invocation and return.
Each thread has a private JVM stack, created at the same time as thread. A new frame is created each time a method is invoked. A frame is destroyed when its method invocation completes.

5. Program Counter Register : PC (program counter) register. It contains the address of the Java virtual machine instruction currently being executed.

6. Native Method Stack : It contains all the native methods used in the application.

7. Execution Engine : It contains:
  1. A virtual processor
  2. Interpreter: Read bytecode stream then execute the instructions.
  3. Just-In-Time(JIT) compiler

Shop and help us

Flipkart Offer Snapdeal offer Amazon.in offer Amazon.com offer

Related Posts:

  • Java 8 - Stream has already been operated upon or closed Java 8 Stream cannot be reused, once its consumed or used. If you are trying to access the stream which already used or consumed will throw IllegalStateException Exception  Exception in thread "main" java.lang.I… Read More
  • Validate MAC Address using Java Regular Expression MAC Address Validator Regular Expression Pattern The standard (IEEE 802) format for printing MAC-48 addresses in human-friendly form is six groups of two hexadecimal digits, separated by hyphens - or colons :. ^([0-9A-Fa-f]… Read More
  • Java 8 - Convert Array to Stream In this article we are going to see about Java 8 - Convert Array to Stream Example ArrayToStream.java package com.javatutorialcorner.java8; import java.util.Arrays; import java.util.stream.IntStream; import java.util.strea… Read More
  • Java Environment Setup in Windows This article explains about how to setup Java in windows operating system. To setup Java in Linux environment follow instruction given in following link Java Environment Setup in Linux Download Java Java Development kit fr… Read More
  • Java 8 - Convert a Stream to List In this article we are going to see about Java 8 - Convert a Stream to List using Collectors.toList() StreamToList.java package com.javatutorialcorner.java8; import java.util.List; import java.util.Objects; import jav… Read More
  • Blogger Comments
  • Facebook Comments
  • Disqus Comments

3 comments:

  1. I am glad that part of this java tutorials corner. Educating free on java programming to the beginners is excellent.
    Thank you

    ReplyDelete
  2. Really a needy course for All computer aspirants.A great initiative. Thank you sir.

    ReplyDelete

Item Reviewed: Introduction to Java Virtual Machine (JVM) Rating: 5 Reviewed By: eHowToNow