The underlying principle of Java's JVM

Video teaching: https://ke.qq.com/course/433760?taid=3851048066653792

51 self-learning network gecko:

JVM is a java virtual machine , it is a virtual computer, it also has CPU and memory, it is not realized through hardware, but through software;

---The computer is composed of hardware, driver, liunx, system (ubuntu, virtual machine, etc.), application software ----

Just install the JDK (JDK includes JVM, common tools, basic API, Java compiler JRE)

JVM includes: stack area, heap area, static area and code area

Local variables exist in the stack area and exceed the scope of the variable. They can be used in the for loop. If called outside the for loop, an error will be reported. This is because the local variable exceeds the scope and is released by the system.

Stack memory: If 9 exists, a and b access a 9, which is the characteristic of stack memory;

Heap memory: The new thing is in the heap memory, which is the real thing.

Declaring that a type is a reference type (stored in the stack), how to distinguish between a reference type and a new type, how to access it, first access the reference type (stack), and then access the new type. As shown below:

 

JDK contains JRE, JVM is at the bottom of JRE, with the concept of heap and stack, as shown in the figure

The entire virtual machine is composed of three major blocks: 1. Loading subsystem; 2. Memory model; 3. Execution engine;

Stack

As soon as main starts, it generates a stack of local variables.

The new objects are all in the heap, and the stack stores variables during the generation of each thread;

The stack is unique to the thread, each thread creates a stack, and the heap is shared by the threads;

The stack is a typical data structure, first in, last out;

heap

default

You can set it yourself;

The new objects are placed in Eden Park;

 

Garbage collection mechanism GC, please check : https://blog.csdn.net/bbs11007/article/details/104632180

 

Guess you like

Origin blog.csdn.net/bbs11007/article/details/100066875