Role of JVM

JVM first identifies the operating system and processor of a computer and then converts byte code instructions into machine language instructions which are executed by micro processor.

JVM Architecture


Class loader sub system
ClassLoader subsystem does the following tasks:

  1. It loads .class file into memory(RAM).
  2. It verifies the byte code instructions of .class file.
  3. Then it allocates the required memory for the java program.
  4. The memory allocated by the classloader subsystem is called Runtime Data Areas.

The data runtime Data Areas are divided into following 5 parts.

  1. Method Area
    These are the data area’s which contains code for methods,class code and variable code.
  2. Heap Area
    Objects are created in heap memory.
  3. Java Stacks
    These are the memory area’s where the methods are executed.Java stacks are derived into several frames and on each frame a separate method will be executed.
  4. PC registers

    These are the memory area’s which contains memory address of the methods.If we have two methods then two 2 PC registers will be created.

  5. Native Method Stacks
    These are the data area’s where ‘c’ and ‘c++’ functions are executed.

Native Method Interface

It is a program it loads native method libraries into JVM.

Execution Engine
It converts byte code instructions into machine language instructions.