当前位置:网站首页>Preliminary foundation JVM
Preliminary foundation JVM
2022-07-25 02:53:00 【Novice Xiaobai Xiaoyi】
jvm
1、jvm Architecture of – General flow chart
[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-3h0Fas8Y-1633614596441)(E:\typora\java Concurrent programming \jvm General flow chart .png)]
1.1 Class loader and parental delegation mechanism
Class loader :
1. Start class loader :Bootstrap classLoader: Mainly responsible for loading the core class library (java.lang.* etc. ), structure ExtClassLoader and APPClassLoader
2. Extend the classloader : Mainly responsible for loading jre/lib/ext Some of the extended jar.
3. Apply the class loader : It is mainly responsible for loading the main function class of the application
Parent delegate mechanism :
When class When the file is about to execute , Not considering that we define class loaders , Then we will keep looking for the parent class until we find our final parent class, that is, the startup class loader . Generally, getting the final parent class will return null, Roughly because of oil c/c++ We don't have permission to access
1.3 Sandbox security mechanism
The default local code is safe by default , And the remote code may be infected by viruses , So we need to give some permissions
1.4 Method area -----native
Method area is shared by all threads , All bytecodes
Primary storage : static const 、 Constant 、 Class information
static、final、class、 Constant pool
-----————————
Everything is added. native Method statement java The effect of , Going to call C The library of languages
public class jjk{
public static void main(String[] args){
}
// No mistake.
private native void hello();
}
effect : Expand java Use , Integrate different programming languages into java Use
*** Not commonly used , Unless there is a problem with the calling hardware
2 Stack
data structure
Program = data structure + Algorithm
Program = frame + Business logic
2.1 characteristic
First in, then out 、 Last in, first out
----> contrast queue fifo (FIFO)
2.2 Stack memory
In charge of the running of the program , Life cycle and thread synchronization , When the stack ends, the stack memory is released , There will be no garbage
8 The big basic type + Object reference + Example method
Operation principle : Stack frame
3 in jvm
java -version Check what you use jvm
What we often use is Sun The company's HotStop
4 Pile up
One jvm There's only one heap memory , The size of heap memory can be adjusted ( There is only one pile, so there is a lot of garbage )
General storage : class 、 Method 、 Constant 、 Variable , Reference the real object of the class
- New Area
- Retirement area
- The permanent zone
gc: Garbage recycling is mainly in Yidian district and pension area
When the memory is full oom, There's not enough heap memory
4.1 New Area
- Where classes are born and die
- Eden : All objects in this go inside new Coming out
4.2 The permanent zone
- jdk1.6: Forever , The constant pool is in the method area
- jdk1.7: Forever , Slowly degenerated , To the eternal generation , The constant pool is in the heap
- jdk1.8: There is no permanent generation , Constant pool in cloud space
tuning :-Xms1024m -Xmx1024m -Xx:PrintGCDetails
-Xms1m -Xmx8m -Xx:+HeapDumpOn( Add abnormal error )
Tools :JProfiler
- analysis dump Memory files , Quickly locate memory leaks
- Get the data in the heap memory
- Get big objects
5 Garbage collection mechanism
Garbage is generated in the method area and heap --GC
GC It is divided into : heavy GC( overall situation ) And light GC
5.1 Reference counting
Basically useless , When new An object is +1 Reduce when not in use 1 When it comes to 0 It's clear when
5.2 Mark clearly
Mark the surviving object
When it is used up, it will be scanned again : The unmarked ones will be cleared
advantage : It doesn't take up space
Take some : Two scans waste time , Memory fragmentation will occur
5.3 Copy algorithm
— Who is empty and who is to
When survival passes enda Enter the area from and to District It will from Copy it to to District , The of this space-time is to The one in the district is from District ; Generally, when the object experiences 15 After that, you will enter the elderly area
边栏推荐
- UDP message structure and precautions
- JS written test question -- prototype, new, this comprehensive question
- Jenkins plug-in development -- plug-in expansion
- List.stream common operations
- Redis unauthorized access vulnerability recurrence (www.hetianlab.com)
- [jailhouse article] scheduling policies and system software architectures for mixed criticality
- # CF #808 Div.2(A - C)
- Threat report in June: new bank malware malibot poses a threat to mobile banking users
- Three ways to solve your performance management problems
- String class
猜你喜欢

The latest interview questions and analysis of software testing in 2022

JS foundation -- task queue and event loop

Domestic edge computing organization and product research

Picgo configuring Alibaba cloud OSS

6. Object storage

After working for two months in the summer vacation, I understood three routing schemes of keepalived high availability

Pypi counts the number of Downloads

Cookies and sessions

6.0 cancellation of member registration verification code

If there is a segment in the encryption field, are you "bronze" or "King"?
随机推荐
After six years of precipitation, new consumption has found a digital transformation paradigm
Request and response
Flutter apple native Pinyin keyboard input exception on textfield | Pinyin input process callback problem
[circular array] JS method collection of circular array
JS foundation -- task queue and event loop
Work arrangement of generator set
Rolling division, Young's matrix and three-step flip
My creation anniversary (3rd Anniversary)
Jenkins plug-in development -- plug-in expansion
Class notes (4) (2) -- 572. Compete
@Retryable @backoff @recover retry the use of annotations
Introduction to web security telent testing and defense
BGP introduction
"Introduction to interface testing" punch in day06: interface testing platform: are tools and frameworks incompatible?
String class
If there is a segment in the encryption field, are you "bronze" or "King"?
Go common standard library -time
C language: Structure -- a detailed explanation of memory byte alignment
JS written test question -- browser kernel
Matlab draws radar chart (four lines of code)