Skip to main content

JAVA VIRTUAL MACHINE

Java Programming



Java Virtual Machine (JVM) is  the heart of  entire  Java program execution process. First of all, the .java program is converted into a .class file consisting of byte code instructions by the java compiler at the time of compilation. Remember, this java compiler is outside the JVM. This .class file is given to the JVM.

                       Following figure shows the architecture of Java Virtual Machine



Method Area  // Class Area:

Class area is the logical memory block of JVM, which holds information about classes and interfaces. Static variables are treated as class variables, because they take memory from method area. The size of the method area shrinks and expands according to the size of the application.

 Heap:

In Java when an object or an array is created, memory is allocated to them from heap. The JVM through the use of new operator allocates memory from the heap for an object. The JVM has a daemon thread known as Garbage Collector whose task is to free those object from heap whose reference is not alive in stack.

 JVM Language Stack || JAVA Stack:

Method  code  are  stored  on Method  area. But  while  running  a method,  it needs some more memory  to store  the data and results. This memory is allotted on Java Stacks.  So,  Java  Stacks  are  memory  area  where  Java  methods  are  executed.

PC  (Program  Counter)  registers: 

It keep track of the sequence of execution of the program. These are the registers (memory areas), which contain memory address of the instructions of the methods or PC register or program counter register holds the addresses of the instructions to be executed next.

 Native Method  Stacks:

When a Java application invokes a native method, that application does not only use  Java  Stacks but also uses the native method stack for the execution of native methods (for  example  C/C++  functions).  To execute the native methods, generally native method libraries (for example C/C++ header files) are required. The libraries required for the execution of native methods are available to the Java Virtual Machine through Java Native Interface.

Execution  Engine:

 contains  interpreter  and  JIT  compiler  which  translates  the  byte  code instructions  into  machine  language  which  are  executed  by  the  microprocessor.  Hot  spot (loops/iterations) is the area in .class file i.e. executed by JIT compiler. JVM will identify the Hot spots  in  the  .class  files  and  it will  give  it  to  JIT  compiler where  the  normal  instructions  and statements of Java program are executed by the Java interpreter.







Comments

Popular posts from this blog

Concept of OOPS

Java Programming This are the basic concept of OOPS. 1. Object 2. Class 3. Data abstraction 4. Data encapsulation 5. Inheritance 6. Polymorphism 7. Dynamic binding Java Classes/Objects Java is an object-oriented programming language. Everything in Java is associated with classes and objects, along with its attributes and methods. For example: in real life, a car is an object. The car has  attributes , such as weight and color, and  methods , such as drive and brake. A Class is like an object constructor, or a "blueprint" for creating objects. Create a Class To create a class, use the keyword  Myclass.java Create an Object In Java, an object is created from a class. We have already created the class named  MyClass , so now we can use this to create objects. To create an object of  MyClass , specify the class name, followed by the object name, and use the keyword  new : Example=> public class Myclass{ int x=10;...

DBMS LEARNING SHEET

                                                            Types of DATA Structured data are facts concerning objects and events. The most important structured data are numeric, character, and dates. Structured data are stored in tabular form. Unstructured data are multimedia data such as documents, photographs, maps, images, sound, and video clips. Unstructured data are most commonly found on Web servers and Web-enabled databases. Database A database is a collection of data that is organised in such a way that it provides efficient retrieval of desired information. This collected data could be in any format like printed, audio, electronic and graphic. Consider an example of an address book, it is also a database that provides information of personal contacts of persons. DBMS A Database Mana...
Java Programming