JVM Arcitecture

Java Virtual Machine :

At the heart of Java technology lies the Java Virtual Machine--the abstract computer on which all Java
programs run. Although the name "Java" is generally used to refer to the Java programming language,
there is more to Java than the language. The Java Virtual Machine, Java API, and Java class file work
together with the Java language to make the Java phenomenon possible.

Java's architecture arises out of four distinct but interrelated technologies
l the Java programming language
2 the Java class file format
3 the Java Application Programming Interface
4 the Java Virtual Machine

When you write and run a Java program, you are tapping the power of these four technologies. You
express the program in source files written in the Java programming language, compile the source to
Java class files, and run the class files on a Java Virtual Machine. When you write your program, you
access system resources (such as I/O, for example) by calling methods in the classes that implement the
Java Application Programming Interface, or Java API. As your program runs, it fulfills your programís
Java API calls by invoking methods in class files that implement the Java API. You can see the
relationship between these four parts below


The Architecture of the Java Virtual Machine

Java Virtual Machine has a class loader subsystem: a mechanism for loading types (classes and interfaces) given
fully qualified names. Each Java Virtual Machine also has an execution engine: a mechanism
responsible for executing the instructions contained in the methods of loaded classes.

Run Time 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 several runtime data areas.

Class Loader Subsystem

The class loader subsystem is responsible for more than just locating and importing the binary data for
classes. It must also verify the correctness of imported classes, allocate and initialize memory for class
variables, and assist in the resolution of symbolic references. These activities are performed in a strict
order:
1. Loading: finding and importing the binary data for a type

2. Linking: performing verification, preparation, and (optionally) resolution
a. Verification: ensuring the correctness of the imported type
b. Preparation: allocating memory for class variables and initializing the memory to default
values
c. Resolution: transforming symbolic references from the type into direct references.

3 Initialization: invoking Java code that initializes class variables to their proper starting values.