Java JVM Execution Engine: Interpreter, JIT Compiler, and Garbage Collector

📘 Java – Day 04 | JVM Execution Engine How does JVM actually execute our Java code after loading it into memory? Today I learned about the Execution Engine, which is the part of JVM that actually runs our program. Here’s how execution happens in simple terms: - Interpreter starts executing bytecode line by line - Simple but slower because the same code may be interpreted again and again - JIT Compiler (Just-In-Time) improves performance - It detects frequently executed code (hot code) - Converts it into native machine code once - Reuses it directly next time → faster execution - Garbage Collector (GC) runs automatically - Frees heap memory by removing objects that are no longer referenced - Helps prevent memory leaks - JNI (Java Native Interface) acts as a bridge - Allows Java to interact with native code written in C/C++ - Native Method Stack handles execution of these native calls Understanding this explained why Java programs may feel slower at startup but become faster as they continue running. #Java #JVM #ExecutionEngine #CoreJava

  • diagram

To view or add a comment, sign in

Explore content categories