1. Relationship between JDK, JRE, and JVM. JDK includes JRE and other development tool libraries such as compiler, debugging, jconsele performance testing tools, etc.
2. Composition of JVM: The Class Loader subsystem, execution engine, and runtime data zone, such:
3. Composition of runtime data zones in JVM specifications:
(1) Method Area: stores metadata such as class information, static variables, constant pools, and threads.
(2) Heap: stores object instances, arrays, and other data, which are shared by threads.
(3) PC register, private thread
(4) JVM method stack, private thread
(5) local method stack, private thread
When Java Virtual Machine hotspot is implemented, the JVM method stack and the local method Stack are merged. The method zone is also called the persistent generation.
4. Garbage collection algorithm: Generation-based garbage collection. The life cycle of new generation objects is short based on the replication algorithm, and the life cycle of old generation objects is long. The method is implemented based on Mark cleaning or mark sorting.
5. JVM performance optimization: Key parameters:-XMS,-xmx,-xmn,-XX: Invalid vorratio,-XX: maxtenuringthreshold,-XX: permsize,-XX: maxpermsize
-XMS and-xmx are usually set to the same value to avoid continuous JVM memory expansion during runtime. This value determines the maximum memory that JVM heap can use.
-Xmn determines the size of the new generation space. The ratio of the New Generation Eden, S0, and S1 can be controlled through-XX: discounted vorratio (if the value is 4, EDEN: S0: s1 =)
-XX: the number of times the maxtenuringthreshold control object enters the old age after the minor GC. this parameter is only valid for serial GC.
-XX: permsize,-XX: maxpermsize is used to control the size of the Method Area, usually set to the same value.
JVM learning Summary