JVM ARCHITECTURE
STORAGE AREAS
- Registers
- Stacks
- Heap
- Constant Storage
- Non Ram Storage
REGISTER
The registers of the Java Virtual Machine are similar to the registers in our computer. However, because the Virtual Machine is stack based, its registers are not used for passing or receiving arguments. In Java, registers hold the machine's state, and are updated after each line of byte code is executed, to maintain that state. The following four registers hold the state of the virtual machine:

HEAP
- frame, the reference frame, and contains a pointer to the execution environment of the current method.
- optop, the operand top, and contains a pointer to the top of the operand stack, and is used to evaluate arithmetic expressions.
- pc, the program counter, and contains the address of the next byte code to be executed.
- vars, the variable register, and contains a pointer to local variables.
STACK & HEAP
STACK
The Java Virtual Machine uses an operand stack to supply parameters to methods and operations, and to receive results back from them. All byte code instructions take operands from the stack, operate on them, and return results to the stack. Like registers in the Virtual Machine, the operand stack is 32 bits wide.
The operand stack follows the last-in first-out (LIFO) methodology.
A call stack is a stack data structure that stores information about the active subroutines of a computer program. This kind of stack is also known as an execution stack,control stack, run-time stack, or machine stack
The stack frame holds the state of the method with three sets of data: the method's local variables, the method's execution environment, and the method's operand stack.

HEAP
What is Heap space in Java?
When a Java program started Java Virtual Machine gets some memory from Operating System. Java Virtual Machine or JVM uses this memory for all its need and part of this memory is call java heap memory.Heap is located at bottom of the address
Size of Java Heap
Default size of Heap space in Java is 128MB on most of 32 bit Sun's JVM but its highly varies from JVM to JVM e.g. default maximum and start heap size for the 32-bit Solaris Operating System (SPARC Platform Edition) is -Xms=3670K and -Xmx=64M and Default values of heap size parameters on 64-bit systems have been increased up by approximately 30%. Also if you are using throughput garbage collector in Java 1.5 default maximum heap size of JVM would be Physical Memory/4 and default initial heap size would be Physical Memory/16. Another way to find default heap size of JVM is to start an application with default heap parameters and monitor in using JConsole which is available on JDK 1.5 onwards, on VMSummary tab you will be able to see maximum heap size.




