User:Pradeepkumargv/Jvm's block diagram

The Architecture of the Java Virtual Machine

In Java when we compile the source file(i.e .java file also known as compilation unit) using java compiler(Javac read as "java c") the source is converted into the JVM understandable Bytecode(i.e .class file).Further this Bytecode is converted into machine understandable Binary code by the JVM.

The conversion of Bytecode undergoes a lot of process. Javac generates .class file and jvm undertakes this .class file to generate Binary code. Internally the JVM consists of 1)CLASS LOADER SUB SYSTEM 2)RUNTIME DATA AREA 3)EXECUTION ENGINE 4)NATIVE METHOD INTERFACE 5)NATIVE METHOD LIBRARIES

1) CLASS LOADER SUB SYSTEM:When JVM undertakes the .class file,the CLASS LOADER SUB SYSTEM loads the .class file into the memory area called RUNTIME DATA AREA or in other words we say CLASS LOADER SUB SYSTEM allocates memory to the .class file.'''

2) RUNTIME DATA AREA:When a Java virtual machine runs a program, it needs memory to store many things, including bytecodes and other information it extracts from loaded class files, objects the program instantiates, parameters to methods, return values, local variables, and intermediate results of computations. The Java virtual machine organizes the memory it needs to execute a program into 5 parts namely METHOD AREA,HEAP,JAVA STACKS,PC REGISTERS and NATIVE METHOD STACKS.

a)METHOD AREA:When the virtual machine loads a class file, it parses data contained in the class file places into the method area. b)HEAP:As the program runs, the virtual machine creates and places all objects on the HEAP. c)JAVA STACKS:This is the area where java methods are executed. d)PC REGISTERS:These registers provide the memory addresses of the machinecode(binarycode) instructions that are to be executed by the microprocessor. e)NATIVE METHOD STACKS:This is the area where native mthods(c,c++ methods in which java is written) are stored and executed.This is done by NATIVE METHOD INTERFACE.i.e it copies native methods from NATIVE METHOD LIBARRIES(C,C++ HEADERS) into JVM. 3)EXECUTION ENGINE:Actually it is responsible for converting Bytecode into Binarycode(we generally say JVM converts the Bytecode into Binarycode).It consists an Interpreter and a JIT compiler.

4)NATIVE METHOD INTERFACE:It copies the native methods from NATIVE METHOD LIBARRIES(C,C++ HEADERS) into JVM.

5)NATIVE METHOD:These are the C,C++ methods which are used in the construction of java.