Saturday, July 29, 2017

JVM Architecture


JVM is a virtual machine or a program that provides run-time environment in which java byte code can be executed. JVMs are available for many hardware and software platforms.

The use of the same byte code for all JVMs on all platforms makes java platform independent.






Class loader subsystem
Class loader subsystem will load the .class file into java stack and later sufficient memory will be allocated for all the properties of the java program into following five memory locations

      Heap area
      Method area
      Java stack
      PC register
      Native stack

Heap area:

In which object references will be stored.

Method area

In which static variables non-static and static method will be stored.

Java Stack

In which all the non-static variable of class will be stored and whose address referred by object reference.

Pc Register

Which holds the address of next executable instruction that means that use the priority for the method in the execution process?

Native Stack

Native stack holds the instruction of native code (other than java code) native stack depends on native library. Native interface will access interface between native stack and native library.

Execution Engine

It is a part JVM that uses Virtual processor (for execution).which contain interpreter (for reading instructions) and JIT (Just in time) compiler (for performance improvement) for executing the instructions.

How JVM is created

When JRE installed on your machine, you got all required code to create JVM. JVM is created when you run a java program.

Lifetime of JVM

When an application starts, a runtime instance is created.
When application ends, runtime environment destroyed.
If “n”no. of applications starts on one machine then “n” no. of runtime instances are created and every application run on its own JVM instance.

Main task of JVM

1. Search and locate the required files.
2. Convert byte code into executable code.
3. Allocate the memory into ram.
4. Execute the code.
5. Delete the executable code.


No comments:

Post a Comment