Execution Engine in JVM

Execution Engine in JVM

In this tutorial we are going to discuss about execution engine in JVM (Java virtual machine). This is the core of the JVM. Execution engine can communicate with various memory areas of JVM. Each thread of a running Java application is a distinct instance of the virtual machine’s execution engine. The byte code that is assigned to the run time data areas in the JVM via class loader is executed by the execution engine.

In order to execute the code, an execution engine is used. In this tutorial, let’s understand the execution engine and different components in it.

The execution engine reads the Java Byte code in the unit of instruction. It is like a CPU executing the machine command one by one. Each command of the byte code consists of a 1-byte OpCode and additional Operand. The execution engine gets one OpCode and execute task with the Operand, and then executes the next OpCode. Execution engine mainly contain 2 parts.

  1.  Interpreter
  2.  JIT Compiler

Whenever any java program is executing at the first time interpreter will comes into picture and it converts one by one byte code instruction into machine level instruction. JIT compiler (just in time compiler) will comes into picture from the second time onward if the same java program is executing and it gives the machine level instruction to the process which are available in the buffer memory. The main aim of JIT compiler is to speed up the execution of java program.

1. Interpreter

It is responsible to read byte code and interpret into machine code (native code) and execute that machine code line by line. The problem with interpret is it interprets every time even some method invoked multiple times which effects performance of the system. To overcome this problem SUN people introduced JIT compilers in 1.1 V.

2. JIT Compiler

The JIT compiler has been introduced to compensate for the disadvantages of the interpreter. The main purpose of JIT compiler is to improve the performance. Internally JIT compiler maintains a separate count for every method. Whenever JVM across any method call, first that method will be interpreted normally by the interpreter and JIT compiler increments the corresponding count variable. 

This process will be continued for every method once if any method count reaches thread hold value then JIT compiler identifies that method is a repeatedly used method (Hotspot) immediately JIT compiler compiles that method and generates corresponding native code. Next time JVM come across that method call then JVM directly uses native code and executes it instead of interpreting once again, so that performance of the system will be improved. Threshold is varied from JVM to JVM. Some advanced JIT compilers will recompile generated native code if count reaches threshold value second time so that more optimized code will be generated.

JIT compilation requires processor time and memory usage. When the java virtual machine first starts up, thousands of methods are invoked. Compiling all these methods can significantly affect startup time, even if the end result is a very good performance optimization.

Profiler which is the part of JIT compiler is responsible to identify Hotspot (Repeated Used Methods).


JVM interprets total program line by line at least once. JIT compilation is applicable only for repeatedly invoked method but not for every method.

Execution Engine in JVM
Java Native Interface (JNI)

JNI is acts as a bridge (Mediator) for java method calls and corresponding native libraries. 


Profiler: This is a tool which is the part of JIT Compiler is responsible to monitor the java bytecode constructs and operations at the JVM level.

That’s all about execution engine in JVM. If you have any queries or feedback, please write us at contact@waytoeasylearn.com. Enjoy learning, Enjoy JVM..!!

Execution Engine in JVM
Scroll to top