Saturday 11 July 2015

The Java Virtual Machine(JVM) Architecture

All languages compilers translate source code into machine code for a specific computer. Java compiler also does the same thing. Java compiler produces am intermediate code known as bytecode for a machine that does not exist. This machine is called the java virtual machine and it exist only inside the computer memory.


Process of compilation


Java Virtual Machine(JVM) is the heart of entire java program execution process. It is responsible for taking the .class file and converting each byte code instruction into the machine language instructions that can be executed by the microprocessor.


Java Virtual Machine
  1. First of all the .java program is converted into a .class file consisting of byte code instructions by the java compiler.
  2. In JVM, there is a module ( or program) called class loader sub system, which performs the following functions.
  •  First of all, it loads the .class file into memory.
  •  Then it verifies whether all byte code instructions are proper or not. If it finds any instruction  suspicious, the execution is rejected immediately.
  •  If the byte instructions are proper, then it allocate necessary memory to execute the program.
This memory is divided into 5 parts, called run time data areas, which contain the data and results while running the program. There areas are as follows.

Method Area: 

 Used to store class code, code of variables, and code of the java program. 

Heap Area: 

 This is the place where objects are created. Whenever JVM loads a class, a method and a heap are are immediately created in it.

Java Stack: 

 Method code is stored on method area. But while running a method, it needs some more memory to store the data data and results. This memory is allotted on java stacks. So, Java    stack are memory areas where java methods are executed. While executing methods, a separate frame will be created in the java stack, where the method is executed.

Program Counter Registers: 

 These are the registers, which contain memory address of the instructions of the methods,. If there are 4 methods, 4 PC registers while be used to track the instructions of the methods.

Native method stacks: 

 Java methods are executed on java stack. Similarly native methods are executed on native method area.

The execution engine contains interpreter and JIT compiler, which are responsible for converting the byte code instructions into machine code so that the processor while execute them. Most of the JVM implementation use both the interpreter and JIT compiler simultaneously to convert the byte code. This technique is also called adaptive optimizer.


0 comments :

Post a Comment

Note: only a member of this blog may post a comment.

Machine Learning

More

Advertisement

Java Tutorial

More

UGC NET CS TUTORIAL

MFCS
COA
PL-CG
DBMS
OPERATING SYSTEM
SOFTWARE ENG
DSA
TOC-CD
ARTIFICIAL INT

C Programming

More

Python Tutorial

More

Data Structures

More

computer Organization

More
Top