0% found this document useful (0 votes)
37 views

1.9 How JVM Works Internally in Java

The document discusses how the Java virtual machine (JVM) works internally. It explains that the JVM analyzes and executes Java bytecode in a platform-independent way. It then describes the main components of the JVM, including the class loader, class area, heap, stack, program counter register, native method stack, and execution engine.

Uploaded by

harendra tomar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views

1.9 How JVM Works Internally in Java

The document discusses how the Java virtual machine (JVM) works internally. It explains that the JVM analyzes and executes Java bytecode in a platform-independent way. It then describes the main components of the JVM, including the class loader, class area, heap, stack, program counter register, native method stack, and execution engine.

Uploaded by

harendra tomar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

How JVM Works Internally In Java

Introduction:

In this article, you will learn, how JVM works internally and its main features in Java.

How JVM works internally?

JVM (Java virtual machine) is very important part of Java, which analyzes and executes Java bytecode.
Hence, we need to know, how JVM works internally.

JVM is a virtual machine. JVM is a platform dependent because configurations of all OS are different and
it helps in execution of program.

Main features of JVM –

1) Network byte order – In Java, when we create class files, the class file uses the network byte order
and JVM uses the network byte order. This is basically used for network transfer.

2) Clear defining the primitive data type – The JVM defines the primitive data type to maintain its
guarantee platform independence.

3) Garbage Collection – The class object is explicitly created by the user and it is automatically destroyed
through garbage collection.

4) Symbolic Reference – In Java, except for primitive data types, all the classes and all interfaces are
referred to Symbolic Reference.

5) Stack-based Machine – All the famous architectures run, based on the registers but Java virtual
machine runs, based on a stack.

JVM performs many works internally:

 It help to loads the code.


 Check the code internally.
 Helps in execution of code.
 Provide runtime environment.
Now, let’s see the internal work process of JVM.

Explanation of Figure:-

 Class loader- In JVM, classloader is mainly used to load the class files.
 Class Area –It is used to store each class structure like field and method.
 Heap – Heap memory is used at runtime, in which objects are allocated.
 Stack – Java stack is used to store frames. Mainly, it is used in thread, because single thread has a
private JVM stack and it is created at the same time, when thread is created.
 PC Register – PC Register stands for Program Counter Register. It contains the address of JVM.
 Native Method Stack – It is used to store the native methods, which is used in the Application.
 Execution Engine – It has three main things.
Virtual processer: It is used at the time of execution.
Interpreter: It is used to read the bytecode and Just-In-Time compiler (JIT): It is used to reduce the
time, required for compilation and improves the performance of compile time.

Summary:

Thus, we learnt, JVM is a virtual machine. JVM is a platform dependent because configuration of all OS
are different and it helps in execution of program. We also learnt, how it works internally in Java.

You might also like