Chapter 3 Runtime Data Area
JVM explained by Song Hongkang from Shang Silicon Valley: bilibili link
1 Overview
- Memory is a very important system resource. It is the intermediate warehouse and bridge between hard disk and CPU, and it carries the real-time operation of operating system and application programs. The memory layout of JVM stipulates the strategy of memory application, allocation, and management of Java in the running process, which ensures the efficient and stable operation of JVM. Different JVMs have some differences in memory division methods and management mechanisms . Combining with the JVM virtual machine specification, let's discuss the classic JVM memory layout.
- 95% of GC tuning is in the heap area and 5% in the method area (called permanent generation before JDK8, and metaspace after JDK8)
2 threads
- A thread is a unit of operation in a program. JVM allows an application to be executed in parallel by multiple threads.
- In Hotsopt JVM, each thread is directly mapped with the native thread of the operating system.
- When a Java thread is ready for execution, a native thread of the operating system is also created at the same time. After the execution of the Java thread terminates, the local thread will also be recycled.
- The operating system is responsible for scheduling all threads to any available CPU entropy. Once the local thread is initialized successfully, it will call the run() method in the Java thread.