Skip to main content

Java Internals

What is JVM?

JVM stands for Java Virtual Machine.

JVM is a virtual machine( a piece of software) that executes Java bytecode. It provides a runtime environment for executing Java applications. The above sketch explains how the same bytecode is run across multiple virtual machines on different operating systems.

If someone talks about the HotSpot, that's the name of the open source JVM developed by developers ar OpenJDK.

The JVM includes memory management, an execution engine, a garbage collector, and a security manager. It is the core component of the JRE and is responsible for executing Java applications.

Sketch

JVM (Java Virtual Machine)
|
+--- Class Loader Subsystem 
|    |
|    +--- Bootstrap, extension, and application class loaders
|    |
|    +--- ...
|
+--- Memory Areas
|    |
|    +--- Heap, Stack, registry, and Other memory areas
|    |
|    +--- ...
|
+--- Execution Engine
|    |
|    +--- Interpreter
|    |
|    +--- JIT compiler
|    |
|    +--- Garbage Collector
|    |
|    +--- ...
|
+--- Native Method Interface
+--- Runtime Data access
+--- Thread Management
+--- Security manager
+--- Monitoring and management, others
+--- ...

JVM is a part of JRE (Java Runtime Environment) and is used to convert the bytecode into machine-level language. This machine is responsible for allocating memory.

In the next lesson, let us see the sketch that differentiates JDK, JRE, and JVM.