Friday, August 17, 2012

JVM Architecture

JVM is the main part of Java architecture and is the part of JRE(Java Runtime Environment).It is a component of the Java system that interprets and executes in our class files.
Memory configuration by the JVM
Each instance of the JVM has one method area, one heap and one or more stacks -one for each thread. When JVM loads a class files, it puts its information in the method area. As the program runs, all objects instantiated are stored in the heap. The stack area is used to store activation records as a program runs.
 Contents of memory Block at runtime
The class loader performs three main functions of JVM, namely: loading, linking and initialization. The linking process consists of three sub-tasks,namely,verification,preparation and resolution.
                                                     Class loading processes
Class loading process
Loading means reading the class file for a type, parsing it to get its information, and storing the information in the method area.The end of the loading process is the creation of an instance of java.lang.Class for the loaded type. The purpose is to give access to some of the information captured in the method area for the type, to the programmer.
The next process handled by the class loader is Linking. This involves three sub-processes: 1.Verification,
2.Preparation and
3.Resolution
Verification is the process of ensuring that binary representation of a class is structurally correct.
Preparation is the process of allocating memory by JVM for the class (i.e static) variables and sets them to default initial values.



No comments:

Copyright © Codingnodes,2014.All Rights Reserved.