JVM(Java Virtual Machine)
The Java virtual machine functions as an interpreter. That is, the JVM exists in the memory space and reads and executes the bytecode of the class file(source code) that compiles the code written in Java.
The JVM is in the form of a sandbox and it is not possible to run external programs in the protected area. In other words, the JVM maintains security in a way that prevents the system from being tampered with.
The JVM is divided into a class loader, a runtime data area, and an execution engine.
The class loader reads the bytecode class file and places the bytecode and data in the execution data area. The Just-in-time(JIT) compiler in the execution engine is then executed.
If necessary, the garbage collector is run to clean up the memory of the heap.
The JIT compiler uses a compilation technique that translates the program into machine language at the point of actual execution. This technique is used to speed up program execution.
The garbage collector in the execution engine is closely related to the heap area of memory.
All newly created objects in the heap area are first assigned to the Young Generation area. If the program continues to run after this area is filled, it performs Minor Garbage Collection to remove unreferenced objects. At this time, all the jobs enter the suspended state and the remaining objects are moved to the Old Generation area even after Minor Garbage Collection is performed. Major garbage collection is performed in this area, and unreferenced objects are removed.
Types of Java VM
There are many other types of Java Virtual Machine (JVM) other than those provided by Oracle.
JRE(Java Runtime Environment)
JRE refers to the execution environment of a Java application. It can be run using modules (such as JAR files and class files) of already compiled Java applications.
JDK(Java Development Kit)
Refers to the development environment for Java applications, and includes tools for developing Java applications such as compilers and debuggers for source files as well as execution environments.