Sunday, 28 May 2017

Introduction To JVM

What is JVM ?

Java virtual Machine(JVM) is a virtual Machine that provides runtime environment to execute java byte code. The JVM doesn't understand Java type, that's why you compile your *.java files to obtain *.class files that contain the byte codes understandable by the JVM.

JVM control execution of every Java program. It enables features such as automated exception handling, Garbage-collected heap.


JVM Architecture : 



Class Loader : Class loader loads the Class for execution. Boot Strap class Loader, Extension class Loader, and Application class Loader are the three class loader which will help in achieving it.
  1. Boot Strap ClassLoader – Responsible for loading classes from the bootstrap classpath,   nothing but rt.jar. Highest priority will be given to this loader.
  2. Extension ClassLoader – Responsible for loading classes which are inside ext folder (jre\lib).
  3. Application ClassLoader –Responsible for loading Application Level Classpath, path mentioned Environment Variable etc.
Method area : All the class level data will be stored here, including static variables. There is only One Method Area per JVM.

Heap : All the Objects and their corresponding instance variables and arrays will be stored here. There is also one Heap Area per JVM. Since the Method and Heap areas share memory for multiple threads, the data stored is not thread safe.


Stack : Local variables and partial results are store here. Each thread has a private JVM stack created when the thread is created.


Program Register : Program register holds the address of JVM instruction currently being executed.


Native method stack : It contains all native used in application.


Executive Engine : The byte code which is assigned to the Run time  Area will be executed by the Execution Engine. The Execution Engine reads the byte code and executes it piece by piece.

  1. Interpreter
  2. JIT Compiler
  3. Garbage Collector

Native Method Interface : Native method interface gives an interface between java code and native code during execution.

Native Method Libraries :It is a collection of the Native Libraries which is required for the Execution Engine.

No comments:

Post a Comment

No of Occurrence in Array

package com.tutorial4u; import java.util.HashMap; /************************************************************  No of Occurrence in Array...