JVM Architecture

Whenever a java application runs, a runtime instance is born. Thus the numbers of runtime instances on a machine are equal to the number of applications which are running. The JVM starts with the invocation of a main() method which needs to be public, static void and takes a String array as argument. Each instance of a JVM has one method area and a heap. These areas are shared by all threads running within the instance. The information regarding the type is loaded from the class files when the JVM loads a class file. This information is stored in the method area. All the objects which are instantiated placed on the heap. The information regarding the type is loaded from the class files when the JVM loads a class file. This information is stored in the method area. All the objects which are instantiated placed on the heap.
Figure: Method Area & Heap
As each new thread is created, it is assigned its
own pc register (program counter) and java stack. If the thread is
executing a java method (not a native method), the counter in the pc
register points to the next instruction to execute.
JVM Architecture
Benefits of the Java Heap:
Allocation of small amounts of memory is very fast.
No need to fish for a free memory segment in RAM.
No fragmentation.
Continuous memory blocks can make a big difference.


