JVM Architecture
https://www.youtube.com/watch?v=Dpuy8WUBq9w
JVM Architecture
Class Loader subsystem:
1.Loading
1. bootstrap class loader
reads class file and stores in binary info. || instance of class that represent
type in heap
2. extension loader
3. Application class loader
JVM →class subsystem ↔ application class loader ↔ extension loader ↔
bootstrap loader
JVM Architecture 1
2.linking
1. verification
.class is generated by valid compiler. Binary correct structure. formatted
properly.
2. preparation
memory allocation, default values,
3. resolution (optional phase)
replace symbols with actual class
3.Initialization
static block execution happens here
class variables are assigned with the actual value
Run Time areas:
1.Method area
created in JVM startup
used to store meta data
also known as meta space.
has info like if its a class, interface, abstract, access modifiers
2.Heap area
NOT THREAD SAFE
memory for objects are allocated on the heap.
The maximum Java heap size is controlled by the -Xmx option
JVM Architecture 2
3.JVM stack
all the threads are in thread stack and once the method is completed or exception
is thrown
its pop the stack
PC registry
1. Native method stack
Execution Engine:
1. Interpreter
read byte code and convert it into machine code | slow in performance
2. JIT compiler
code cache of the interepet code. and increment the count for method.
3. Garbage collector
automatic garbage collection
JVM is response for managing life cycle
remove unreferenced object
JVM Architecture 3
Native method interface:
it enables the JVM to call native libraries that are speciic for hardwares like dlls
or .so
Native method libraries
JVM Architecture 4