Architecture Of JVM (JAVA Virtual Machine)

JVM Internals :-

=>JVM stands for ‘Java virtual Machine’ and which is used to execute Java Byte Code.

=>The s/w component which internally having the behaviour like machine is known as Virtual Machine.

=>JVM internally having the following three partitions:

1.Class Loader SubSystem

2.Runtime Data Area

3.Execution Engine

1.Class Loader SubSystem:

=>Class Loader SubSystem will load the byte code(class) on to JVM, in this process the Class Loader System will use the following :

Components:

(a)Loader

(b)Linker

(c)Initiate

(a)Loader:

=>Loader will load the required files into current running proces, in this process the Loader divided into three SubLoaders:

(i)BootStrap Class Loader

(ii)Extention Class Loader

(iii)Application Class Loader

(i)BootStrap Class Loader:

=>BootStrap CL will load the required files from the JavaLib.

Exp:

Loading ‘String’ and ‘System’ classes from JavaLib.

(ii)Extention Class Loader:

=>Extention CL will load the required files from the ‘ext’ folder.

(iii)Application Class Loader:

=>Application CL will load the required files from ‘classpath’.

(b)Linker:

=>The Linker will link the loaded files into Current running program, in this process the linker use the following components:

(i)Verify

(ii)Prepare

(iii)Resolve

(i)Verify:

=>Verify component will perform verification process,which means it checks the loaded files and the required files are same or not.

(ii)Prepare:

=>Once Verification is Successfull then the ‘prepare’ component will perform decoding process,which means identifying the programming components.

(iii)Resolve:

=>’Resolve’ component will identify the programming components are static or NonStatic based on ‘static’ keyword.

Static Programming components : main()

NonStatic programming components : a,b,c,add()

à define Static programming Components?

=>The programming components which are declared with ‘static’ keyword

are known as static programming components.

Note:

=>These Static programming components will get the memory within the class while class loading and access with class_name.

à define NonStatic Programming components?

=>The programming components which are declared without ‘static’ keyword are known as NonStatic programming components.

Note:

=>These NonStatic programming components will get the memory within the object while object creation and access with object_name.

(c)Initiate:

=>Initiate component will perform initialization process,in this process ‘Runtime Data Area’ is created.

2.Runtime Data Area:

=>This Runtime Data Area is divided into the following:

(a)Method Area

(b)Heap Area

(c)JavaStackArea

(d)PC Register Area

(e)Native Method Area

(a)Method Area:

=>The memory block where the class is loaded known as Method_Area.

=>while class loading static members will get the memmory within the class,in this process main() method got the memory within the class.

=>Once main() method got the memory,it is automatically copied onto JavaStackArea to start the execution process.

=>The ExecutionEngine identifies main() method and starts the execution process.

(b)Heap Area:

=>The memory block where the objects are created is known as Heap Area.

  • Execution behaviour of ‘new’ keyword:

step1 : ‘new’ keyword specify the ExecutionControl to create one reference part of Heap_Area.

step2 : Check the required class is available on Method_Area or not.

step3 : Once the required class is available,then take the NonStatic members from the class and give memory at reference(Address).

step4 : Once all the NonStatic members are binded to reference, then the reference is copied onto ref_variable or Object_name(ob).

(c)JavaStackArea:

=>The memory block where all the methods are executed is known ‘Java Stack Area’.

Note:

=>The first method copied onto JavaStackArea is main() method,this main() method will call remaining methods for execution.

(d)PC Register Area:

=>PC(Program Counter) Regiters will record the status of method execution in Java Stack Area,in this process every method will have its own PC register and all these PC Registers are opened in a separate memory block konwn as ‘PC Register Area’.

(e)Native Method Area:

=>The methods which are declared with ‘native’ keyword,part of JavaLib are known as Native methods and these native methods internally having c or c++ code.

=>when these native method are used part of Java application,then they are separated and loaded onto separate memory block known as Native Method.

=>These Native methods are executed using JNI(Java Native method Interface).

=>while execution JNI uses Native method Libraries

3.Execution Engine:

=>ExecutionEngine is an executer of JVM and which starts the execution process from main() method available on JavaStackArea.

=>This ExecutionEngine internally having the following two

translators:

(i)Interpreter

(ii)JIT Compiler

(i)Interpreter:

=>Interpreter will start the execution process and executes normal instructions.

=>when the interpreter finds the Stream instructions the n the control is transferred to the ‘JIT Compiler’. 

(ii)JIT Compiler: (JIT – Just In Time)

=>This JIT-Compiler will execute Stream instructions.

(Multimedia Instructions)

Leave a Comment

Your email address will not be published. Required fields are marked *