Class Loader and Execution Engine
This chapter covers two core JVM internals from your diagrams:
- Class Loader Subsystem
- Execution Engine
1. Class Loader Subsystem
Class Loader is responsible for bringing class bytecode into JVM runtime.

Three major phases
- Loading
- Linking
- Initialization
2. Loading Stage
Class loader fetches .class bytecode and creates runtime class representation.
Common class loaders
- Bootstrap Class Loader
- Extension (Platform) Class Loader
- Application Class Loader
3. Linking Stage
Linking has three sub-steps:
- Verify: Bytecode validation for safety/correctness.
- Prepare: Allocate memory for static fields with default values.
- Resolve: Convert symbolic references to direct references.
4. Initialization Stage
- Assign explicit static variable values.
- Execute static blocks in class initialization order.
5. Execution Engine
Execution engine runs bytecode after class loading and verification.

Core parts
-
Interpreter
- Executes bytecode line-by-line.
- Fast startup, slower repeated execution.
-
JIT Compiler (Just-In-Time)
- Detects hot code (frequently executed code paths).
- Converts bytecode to native machine code.
- Improves runtime performance significantly.
-
Garbage Collector
- Reclaims memory from unreachable objects.
-
Security and Runtime Services
- Includes safety and profiling support in JVM runtime.
6. JNI and Native Libraries
- JNI (Java Native Interface) allows Java code to call native code (C/C++ etc.).
- Native Method Libraries provide OS-level native implementations.
7. Runtime Flow Summary
Class Loader -> Memory Areas -> Execution Engine
<-> JNI <-> Native Libraries
8. Quick Interview Answers
Q: What are Class Loader phases?
Loading, Linking (Verify/Prepare/Resolve), Initialization.
Q: Why does JVM use both Interpreter and JIT?
Interpreter gives quick startup; JIT optimizes hot code for high performance during long execution.
Q: What is role of JNI?
JNI is a bridge between Java runtime and native platform libraries.