Search This Blog

Tuesday, March 16, 2010

Java Virtual Machine(JVM) in Java for Beginners

Today I am going to answer what is Java Virtual machine?

I am working with the Java from my school days (2000). But I admire why java is very popular than other programming language.

The answer I have got from my teacher is Platform Independent.

Then asked next question is what is platform Independent?

Compiled Java file (.class) can be run in any operating system. It’s not possible using C, C++ because those language uses different compiler for different operating system.

This answer is acceptable in the point of the end user but as a programmer I expected to know more.

So I asked what the class file contains.

He smiled and answered it contains byte code. The byte code is intercepted by the Java Virtual machine (JVM) (System software) program written by sun micro system for different Operating system. The JVM covert s the received byte code to running operating system understandable format.

Finally I land up in started asking what Java Virtual machine is.

My teacher told me go and Refer the Java Spec. Because he is having idea but it can be false information without referring java spec.

Finally I have Refer the Book inside the Java Virtual Machine, 1997.chm by Bill Venners.

Java Virtual Machine:

Heart of the Java is Java virtual machine. Below features are achieved using JVM.

1. Platform Independence

2. Security

3. Network Mobility.

Here we discuss about how we are achieving Platform independence.

What is Java Virtual Machine?

JVM is an abstract computer. It’s nothing but the system software (Program for Interaction with Computer chip).

Main Job of the JVM is load the class files and executes the bytecodes with the help of class loader program.

The class loader program is responsible for loading application class file and required supporting java API.


The Execution Engine which is responsible for executing received byte to the operating understandable format.

There are types of execution engine are

1. Simplest Execution engine- converts the Byte code to the machine understandable code.

2. Just In Time compiler (JTC)–Here byte code of a method are compiled native machine code first time the method invoke. The native machine code for the method is then cached, so it can be re-used the next time that same method is invoked.

Conclusion:

On a Java Virtual Machine built on top of a chip that executes Java byte codes natively, the execution engine is actually embedded in the chip.

So the JVM is the Combination of Class loader and execution engine

Mathematical representation

JVM=Class loader + Execution engine.

Exceution engine=Simplest Execution engine/Just in Time Compiler (JTC).


Need feed back for further improvement.


Regards,

Marimuthu Rajagopal.




2 comments:

  1. machi article is good .plz finish the sentance correctly. you start at one thing but finished at some what way for example "At the Heart of the Java is Java virtual machine" rest of the things is cool man . i also learned from this article that what is the secret of JVM :-)

    ReplyDelete
  2. Good article about JVM, thanks muthu.

    ReplyDelete