1. An overview of the

1.1 Java Virtual Machine family

1.1.1 HotSpot VM

Oracle JDK and OpenJDK built-in virtual machine, the most mainstream and most widely used Java virtual machine.

1.1.2 J9 VM

1.1.3 Zing VM

1.2 Java VM Execution Process

When executing a Java program, its execution flow is as follows:

  • Compile time environment
  • Runtime environment

2. Java VM structure

2.1 Class file format

Class file format:

2.2 Class lifecycle

2.3 Class loading system

  • Bootstrap ClassLoader
  • Extensions ClassLoader
  • Application ClassLoader/System ClassLoader

2.4 Runtime data area

These data areas are the program counter, Java virtual machine stack, local method stack, Java heap, and method area.

2.4.1 Program counter

2.4.2 Java Vm Stack

2.4.3 Local method stack

2.4.4 Java heap

2.4.5 method area

2.4.6 Runtime constant pool

3. Object creation

When the virtual machine receives a new command, it does the following:

4. Heap memory layout of objects

5. Oop – klass model

6. Spam algorithm

6.1 References in Java

  • Strong reference
  • Soft references
  • A weak reference
  • Phantom reference

6.2 Reference counting method

Disadvantages: Reference counting algorithms do not solve the problem of objects referring to each other circularly.

6.3 Root Search Algorithm

Advantages: Resolved that dead objects cannot be reclaimed because they reference each other.

7. The life cycle of a Java object in a VM

Garbage collection algorithms

8.1 Mark-clear algorithm

8.2 Replication Algorithm

8.3 Mark-compression algorithm

8.4 Generational Collection Algorithm

8.4.1 Collection by generation