JVM--Hotspot Architecture Detailed Explanation

1. Overview of Java Virtual Machine (JVM)

Java Virtual Machine A virtual machine (JVM) is an abstract computer. The JVM itself is also a program, but to the programs written to execute in it, it looks like a machine. For a specific operating system, each JVM implementation converts Java programming instructions into instructions and commands that run on the native operating system. In this way, Java programs achieve platform independence. The first JVM implementation was Hotspot

二、Hotspot Architecture

The logical structure diagram of The HotSpot JVM is as follows:
Insert image description here

The main components of the Hotspot virtual machine include the classloader, the runtime data areas, and the execution engine

1. the runtime data areas (runtime data areas)

1. 1 The pc Register (program counter registers) Program Count Register

JVM can support multi-thread running at the same time. Each JVM thread will have its own pc Register. What is stored in the pc Register is actually the address of the currently executed code. If a method (method) is not a native method, then what is stored in pc Register is actually the address of the currently executed code. If a method (method) is a native method, then pc Register is valueless.

1, 2 Heap (heap)

In the JVM, there is an area called Heap, which is shared by all JVM threads. All memory requests for Java class instances and arrays will be allocated (allocated) in in this area.

1、3 Java Virtual Machine Stacks(栈)

Each JVM thread will have a private stack (private Java Virtual Machine stack), which is created together with the thread.

1. 4 Method Area

In the JVM, there is an area called the Method Area, which is shared by all JVM threads.

1、5 Run-Time Constant Pool ()

Guess you like

Origin blog.csdn.net/qq_41768644/article/details/130957998