JVM Architecture

JVM is a program that converts Bytecode instructions into Machine code. The following figure shows the JVM architecture:

JVM Architecture
Fig: JVM Architecture
Now let us know about each part in JVM architecture:

Class Loader: 

In JVM class loader is a module. It will do the following tasks.
  1. Loads the .class file from hard disk into RAM.
  2. Verifies all the bytecode instructions, if any other code is found then it rejects the .class file.
  3. When all the byte code instructions are correct then it will allocate the required memory for the program.

Runtime Data Areas: 

The memory allocated by class loader is called as Runtime Data Areas. There are 5 data areas:
  1. Method Area
  2. Heap
  3. Java Stacks
  4. PC Registers
  5. Native Method Stacks

1. Method Area:

Class code, Method code, static variables and static blocks are also stored on method area.

2. Heap:

Objects are created on heap. It is a huge memory.

3. Java Stacks:

These are the memory areas where Java methods are executed. Java stacks are divided into frames and on each frame a separate method is executed. 

4. PC Registers:

Register is a place where memory address is stored. PC Registers contain memory address of the next instruction to be executed by the processor.

5. Native Method Stacks:

These are the memory areas where native methods(C, C++ programs & functions) are executed. Native method interface is a program that copies Native method libraries into the JVM.

2 comments:

  1. very nice blog for java beginners

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete