Skip to content

Commit 4e5fb89

Browse files
committed
update
1 parent 0fbef39 commit 4e5fb89

File tree

1 file changed

+73
-46
lines changed

1 file changed

+73
-46
lines changed

core-java/java-basics/index.md

Lines changed: 73 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -194,53 +194,80 @@ It is Just-In-Time tool is a compiler that compile modules which required at the
194194
<img src="https://github.com/user-attachments/assets/35075ccb-5472-4bb3-8d65-f21c485be654" class="execution" alt="JVM">
195195
</div>
196196

197-
## Class Loader
198-
It is an essential part of the Java Runtime Environment use to load the classes for execution.
199-
Every class you use need to load into memory first before it can be used.
200-
It loads the class over the network, Jars etc at the time of runtime.
201-
202-
Java Uses a hierarchical delegation model for class loading.
203-
- Bootstrap ClassLoader -> It Loads the classes which need at the time of execution like Native classes (rt.jar).
204-
- Extension ClassLoader -> It Loads Classes from the **ext/** folder path JAVA_HOME/lib/ext.
205-
- Application ClassLoader -> It Loads the user classes or form classpath eg (-cp or CLASSPATH).
206-
207-
Each class Loader loads the parent first, If that unable to find the class then it load itself know as delegation model.
208-
209-
# Loading Phase
210-
## ClassLoader & Memory(Runtime Data Area)
211-
When JVM starts it setup different memory areas.
212-
The classloader loads class files from storage.
213-
- Method Area
214-
It store class metadata like : class name, method, fields, constant pool etc.
215-
The class structure store here basically.
216-
- Heap
217-
In this area the objects and arrays what ever created at runtime store here.
218-
Also In this we have literal pool and all the variables are the part of the method so its reference is store in heap.
219-
ClassLoader itself an object store it here.
220-
- Stack
221-
In this it is create for each thread because each thread has its own stack.
222-
Store method call, local variable etc.
223-
224-
# Linking Phase
225-
## Verify
226-
It verify the .class file that execute properly means cannot be able to penetrate by other malfunction bytecode.
227-
## Prepare
228-
In the prepration module we allocates the stack and heap area for static variables.
229-
## Resolve
230-
In the resolution we replace symbols with actual references
231-
232-
# Working
233-
234-
**.class file** -> **JVM** -> **Create The Heap after verifing the .class file** -> **Create the stack for method calls**
197+
## Class Loader Sub-System
198+
199+
It is an essential part of the Java Runtime Environment used to load the classes for execution.
200+
Every class you use needs to be loaded into memory first before it can be used.
201+
It loads the class over the network, JARs, etc., at the time of runtime.
202+
203+
Java uses a **hierarchical delegation model** for class loading:
204+
- **Bootstrap ClassLoader** → It loads the classes needed at the time of execution, like native classes (rt.jar).
205+
- **Extension ClassLoader** → It loads classes from the `ext/` folder path (`JAVA_HOME/lib/ext`).
206+
- **Application ClassLoader** → It loads user classes or classes from the classpath (e.g., `-cp` or `CLASSPATH`).
207+
208+
Each class loader loads its parent first. If that is unable to find the class, it loads itself — this is known as the **delegation model**.
209+
210+
---
211+
212+
## Loading Phase
213+
214+
### ClassLoader & Memory (Runtime Data Area)
215+
216+
When the JVM starts, it sets up different memory areas.
217+
The class loader loads class files from storage.
218+
219+
- **Method Area**
220+
It stores class metadata such as class name, methods, fields, constant pool, etc.
221+
The class structure is stored here, basically.
222+
223+
- **Heap**
224+
In this area, the objects and arrays created at runtime are stored.
225+
Also, this is where the literal pool and all variables that are part of the method are stored, with their references being stored in the heap.
226+
The **ClassLoader** itself is an object stored in the heap.
227+
228+
- **Stack**
229+
This is created for each thread, as each thread has its own stack.
230+
It stores method calls, local variables, etc.
231+
232+
---
233+
234+
## Linking Phase
235+
236+
### Verify
237+
It verifies the `.class` file to ensure it executes properly and cannot be penetrated by malfunctioning bytecode.
238+
239+
### Prepare
240+
In the preparation module, the stack and heap areas are allocated for static variables.
241+
242+
### Resolve
243+
In the resolution phase, symbolic references are replaced with actual references.
244+
245+
---
246+
247+
## Initializing Phase
248+
249+
In this phase, variables are initialized with their actual values.
250+
251+
---
252+
253+
## Working
254+
255+
**.class file****JVM****Create the Heap after verifying the .class file****Create the Stack for method calls**
256+
257+
---
235258

236259
## Execution Engine
237-
It Runs the bytecode.
238-
**Interpreter** -> Interpret the Bytecode line by line.(One Time Call)
239-
**Jit Compiler** -> Compiles the areas of the code for better performance.(Repeated)
240260

241-
## JNI(Java Native Interface)
242-
It is use to call the method from the Native Method Stack at the time of native code execution by JNI.
243-
It provides a bridge between Java code and Native Code.
244-
It allow calling native libraries written in c/c++ or like .dll, .sl files.
245-
Used system level API's like : OpenGl etc.
261+
It runs the bytecode.
262+
263+
- **Interpreter** → Interprets the bytecode line by line (one-time call).
264+
- **JIT Compiler** → Compiles areas of the code for better performance (repeated).
265+
266+
---
267+
268+
## JNI (Java Native Interface)
246269

270+
It is used to call methods from the **Native Method Stack** during native code execution by JNI.
271+
It provides a bridge between Java code and native code.
272+
It allows calling native libraries written in C/C++ or libraries like `.dll`, `.so`, etc.
273+
It is used for system-level APIs like **OpenGL**, etc.

0 commit comments

Comments
 (0)