Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jvm JIT and Hotspot - What are the differences

I've heard these terms being used, but i cant seem to find a top level view of where they fit in all together in a Java framework. I know JIT is a compiling mechanism, but is it part of JVM? Whats a Hotspot? Is it some new type of VM?

like image 791
Chander Shivdasani Avatar asked Jul 27 '11 21:07

Chander Shivdasani


People also ask

What is the difference between JVM and JIT?

JVM compiles complete byte code to machine code. JIT compiles only the reusable byte code to machine code. JVM provides platform independence. JIT improves the performance of JVM.

What is the difference between the HotSpot JVM and OpenJ9?

Which Java Virtual Machine to choose, HotSpot or OpenJ9? Both are tunable open-source JVM implementations. HotSpot is a well-established JVM implementation initially developed by Sun Microsystems. OpenJ9, developed by IBM, is not as widespread in the industry but has gained popularity in recent years.

What is HotSpot in JVM?

HotSpot, released as Java HotSpot Performance Engine, is a Java virtual machine for desktop and server computers, developed by Sun Microsystems and now maintained and distributed by Oracle Corporation. It features improved performance via methods such as just-in-time compilation and adaptive optimization.

Does JVM use JIT?

The JRockit JVM Runs JIT Compilation In theory, the JIT comes into use whenever a Java method is called, and it compiles the bytecode of that method into native machine code, thereby compiling it “just in time” to execute.


1 Answers

JIT is "Just In Time" compiling, basically compiling on the fly.

Hotspot is the concept within the JVM where it only compiles the code that's actually being used. That is, the "hot" pieces of code being used over and over.

The JVM tracks usage, and when something becomes popular enough, it queues that code for compilation, while continuing to interpret the code.

When the JIT finishes, it swaps out the interpreted bits with the compiled bits.

This is why a JVM needs to "warm up" for benchmarking and such.

The -server and -client options of the Sun/Oracle JVM affect this behavior as to how aggressive they are when doing the JIT work.

like image 114
Will Hartung Avatar answered Nov 02 '22 19:11

Will Hartung