Understanding JVM
JVM (Java Virtual Machine) is all about,an abstract specification; which is a conceptEvery java application will be running in a separate JVM instance even if they are in the same machine. The JVM starts the execution of a Java application from an initial class’ main method. The “java” program from Sun’s JDK is an implementation of a java virtual machine.
a concrete implementation; which runs on many platforms (can be a combination of hardware and software)
a runtime instance; which can host a single java application (each runs on different JVM)
“java
JVM Architecture
Major subsystemsClass loader subsystem:Other components
Responsible for loading classes and interfaces
Execution engine:
Responsible for the execution of the instructions specified in the classes
Runtime data areas
Native interface; interacts with the native libraries
More about runtime data areas
Mechanism to hold all kinds of data items such as instructions, object data, local variable data, return values & intermediate results.
Organization of runtime data areas
How runtime data are stored in the runtime data areas depends on the implementation of the JVM. Some implementation may enjoy the availability of memory and some others may not. The abstract nature of runtime data area specification allows the implementation of JVM in different machines easier.
Some runtime data areas are shared among all the threads in the application, while some others are too specific to an active thread.
Runtime data areas shared among all threads:
Method area: holds the details of each class loaded by the class loader subsystem.Thread specific runtime data areas:
Heap: holds every object being created by the threads during execution
Program counter register:Note:
points to the next instruction to be executed.
Java stack:
hold the state of each method (java method, not a native method) invocations for the thread such as the local variables, method arguments, return values, intermediate results. Each entry in the Java stack is called “stack frames“. Whenever a method is invoked a new stack frame is added to the stack and corresponding frame is removed when its execution is completed.
Native method stack:
holds the state of each native method call in an implementation dependent way.
In JVM there is no registers to store the intermediate values. They are stored in the java stack itself.
Disclaimer : The above contents are taken from the following post :
http://javabeanz.wordpress.com/2007/07/09/understanding-jvm/
No comments:
Post a Comment