A Java virtual machine (JVM) is a virtual machine that enables a computer to run Java programs as well as programs written in other languages, referred to as JVM languages, that are also compiled to Java bytecode. The JVM is detailed by a specification that formally describes what is required in a JVM implementation. Having a specification ensures interoperability of Java programs across different implementations so that program authors using the Java Development Kit (JDK) need not worry about idiosyncrasies of the underlying hardware platform. The JVM reference implementation is developed by the OpenJDK project as open source code and includes a JIT compiler called HotSpot. The commercially supported Java releases available from Oracle are based on the OpenJDK runtime. Eclipse OpenJ9 is another open source JVM for OpenJDK.
JVM specification The Java virtual machine is an abstract (virtual) computer defined by a specification. It is a part of the Java Runtime Environment. The garbage collection algorithm used and any internal optimization of the Java virtual machine instructions (their translation into machine code) are not specified. The main reason for this omission is to not unnecessarily constrain implementers. Any Java application can be run only inside some concrete implementation of the abstract specification of the Java virtual machine. Starting with Java Platform, Standard Edition (J2SE) 5.0, changes to the JVM specification have been developed under the Java Community Process as JSR 924. As of 2006, changes to the specification to support changes proposed to the class file format (JSR 202) are being done as a maintenance release of JSR 924. The specification for the JVM was published as the blue book, whose preface states:
We intend that this specification should sufficiently document the Java Virtual Machine to make possible compatible clean-room implementations. Oracle provides tests that verify the proper operation of implementations of the Java Virtual Machine. The most commonly used Java virtual machine is Oracle's HotSpot. Oracle owns the Java trademark and may allow its use to certify implementation suites as fully compatible with Oracle's specification.
Garbage collectors
Garbage collectors available in Java OpenJDKs virtual machine (JVM) include:
Serial Parallel CMS (Concurrent Mark Sweep) G1 (Garbage-First) ZGC (Z Garbage Collector) Epsilon Shenandoah GenZGC (Generational ZGC) GenShen (Generational Shenandoah) IBM Metronome (only in IBM OpenJDK) SAP (only in SAP OpenJDK) Azul C4 (Continuously Concurrent Compacting Collector) (only in Azul Systems OpenJDK)
Java's design philosophy revolves around the assumption of a garbage collector. Unlike languages such as C++ and Rust, deterministic memory management through a delete keyword (as in C++) is not possible. Even introducing such a feature is not possible, due to a lack of ownership semantics. In fact, the sun.misc.Unsafe and java.lang.foreign (see Foreign Function and Memory API) allocate/deallocate memory outside the Java heap. Due to Java primarily using heap-based allocation, objects are stored as references, and deletion would result in dangling pointers.
… excerpt ends here. Continue reading the full article.

