Java.Core. JVM specification and its implementations?

Let’s go deep into this — understanding the JVM Specification and its implementations is super important for any serious Java developer, especially if you’re preparing for interviews or want to understand Java at the system level.


☕️ What is JVM Specification (JVM Spec)?

📜 Definition

The JVM Specification (sometimes called JVMS) is an official document maintained by Oracle that defines: ✅ What a JVM must do to correctly run Java programs.
✅ The rules and behaviors every JVM implementation must follow (class loading, bytecode execution, memory management rules, etc.).


🏛️ Important: Specification vs Implementation

TermMeaning
SpecificationA document that defines how a compliant JVM must behave. It does not define how it should be implemented internally.
ImplementationThe actual software (executable JVM) you install on your machine. Each JVM vendor builds its own implementation, following the spec.

📘 JVM Specification Covers

✅ Class file format (how .class files should be structured)
✅ Bytecode instructions (the low-level “assembly-like” instructions that JVM understands)
✅ Class loading process (how classes are found and loaded into memory)
✅ Memory areas (Method Area, Heap, Stack, etc.)
✅ Method invocation and return process
✅ Exception handling mechanism
✅ Multithreading and synchronization


🏗️ JVM Implementations

What is a JVM Implementation?

A JVM implementation is the actual program that runs your Java bytecode. It follows the JVM Specification, but it can have its own internal design, optimizations, and extra features.


🔥 Popular JVM Implementations

ImplementationMaintainerDescription
HotSpotOracle/OpenJDKMost common, default JVM in OpenJDK and Oracle JDK
OpenJ9Eclipse FoundationOptimized for cloud and containerized environments (lightweight, fast startup)
GraalVMOracleCan run Java, but also polyglot (JavaScript, Python, etc.), has advanced Just-In-Time (JIT) compiler
Azul ZingAzul SystemsFocused on low latency and consistent performance (great for trading systems)
Dalvik/ARTGoogleUsed for running Java code on Android devices (designed for mobile)

🔗 Relationship: Specification vs Implementations





            Oracle Maintains
                 ⬇️
          JVM Specification
                 ⬇️
      Implemented by Vendors
         |             |
    HotSpot       OpenJ9       (others...)

🚀 Key Points to Remember

TopicSpecImplementation
Exists asDocumentActual software
DefinesRules, behaviorsSpecific design, optimizations
Maintained byOracleOracle, Eclipse, Azul, etc.
ExamplesJVM Spec v17HotSpot, OpenJ9, GraalVM
ChangesRareOften (new features, better GC, etc.)

⚙️ Examples of Differences Between Implementations

AreaHotSpotOpenJ9
Default GCG1Balanced
Startup TimeModerateFaster (focused on low startup time)
Memory UsageModerateLower (more compact metadata)
Custom FeaturesGraal Compiler, MetaspaceShared Classes Cache (speeds up startup)

🔥 Summary Analogy

What It’s LikeExplanation
JVM Spec = RecipeThe official rules for making a JVM
HotSpot/OpenJ9 = ChefsEach JVM vendor follows the recipe, but can add their own techniques (performance tricks, GC tuning)
This entry was posted in Без рубрики. Bookmark the permalink.