Class loading mechanism and introduction to jvm

jvm:
Class loading mechanism:
1. Loading: The class loader reads a binary byte stream based on the fully qualified name of the file
1.1. Obtains the binary byte stream that defines this class through the fully qualified name of a class
1.2. Convert the static storage structure represented by this byte stream into the runtime data structure of the method area
1.3. Generate a java.lang.Class object representing this class in the Java heap as an access entry to these data in the method area
2 .Link
2.1 Verification
File Format Verification Metadata
Verification
Bytecode Verification Symbol
Reference Verification
2.2 Preparation
Allocate memory for static variables of the class and initialize them to default values
​​2.3 Parsing
Convert symbol references in the class to direct references
3. Initialization
pair Static variables of the class, static code blocks perform initialization operations
4. Use
5. Uninstall

Class loader:
1. Bootstrap is installed under the rt package of javahome.
2. Extension loads the jar package of java platform extension. Loads the jar package under lib/*.
3. The jar package under app classpath.
4. Custom customized package
has been loaded . The class is no longer loaded.
Query up and delegate
down. Query up the class loader to see if the current loader can load the current class. If not, delegate down.
Break the parental delegation and inherit the class override method of a class loader.

Runtime data area:
1. Method area: constant pool at runtime
2. Heap: holds instances of classes, and arrays
3. Virtual machine stack: thread execution area, stores the status of thread execution, java methods
4. Local method stack : native method
5. Program counter: record the bytecode address for the java method, and leave it empty for the native method.

When a thread runs an algorithm, time slices are allocated through the thread scheduling algorithm.

In the heap area, the memory ratio between s0 area and s1 area is 1:1, the eden area ratio s0 area ratio s1 area is 8:1:1 s0 area
and s1 area

Guess you like

Origin blog.csdn.net/sam475259540/article/details/132720607
Recommended