In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "what is the runtime data area". The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the runtime data area".
Preface
This section is mainly about the run-time data area, which is the part of the figure below, which is the stage after the class loading is complete.
When we have completed the previous stages of class loading-> validation-> preparation-> parsing-> initialization, we will use the execution engine to use our class, and at the same time the execution engine will use our runtime data area
In other words, the chef cooks, and we compare the things behind the chef (cut dishes, knives, seasonings) to the runtime data area. The chef can be compared to the execution engine, making exquisite dishes from what is prepared.
Memory is a very important system resource, and it is the intermediate warehouse and bridge between hard disk and CPU. The real-time operation of operating system and application programs is carried by JVM memory layout, which prescribes the strategy of memory application, allocation and management in the running process of Java, and ensures the efficient and stable operation of JVM. There are some differences in memory partition and management mechanism among different JVM (mainly aiming at the method area). Combined with the JVM virtual machine specification, this paper discusses the classic JVM memory layout.
The data we get through disk or network IO need to be loaded into memory first, and then CPU gets the data from memory to read, that is to say, memory acts as a bridge between CPU and disk.
Complete diagram of the runtime datazone
The Java virtual machine defines several run-time datazones that are used when the program is running, some of which are created when the virtual machine starts and destroyed when the virtual machine exits. Others correspond to threads one by one, and these data regions corresponding to threads are created and destroyed as the thread starts and ends.
The gray ones are private to individual threads and the red ones are shared by multiple threads. That is:
Each thread: independently includes program counter, stack, local stack.
Sharing between threads: heap, out-of-heap memory (permanent generation or metaspace (understood as method area), code cache)
Instructions for sharing between threads:
There is only one instance of Runtime per JVM. The runtime environment, which is equivalent to the box in the middle of the memory structure: the runtime environment
Thread
A thread is a running unit in a program. JVM allows an application to execute in parallel with multiple threads.
In Hotspot JVM, each thread maps directly to the local thread of the operating system.
When a Java thread is ready to execute, a local thread of an operating system is also created. When the execution of the Java thread terminates, the local thread also reclaims.
The operating system is responsible for scheduling all threads to any available CPU. Once the local thread is successfully initialized, it calls the run () method in the Java thread.
JVM system thread
If you use jconsole or any debugging tool, you can see that there are many threads running in the background. These background threads do not include the mainthread that calls public static void main (String []) and all threads created by the main thread itself.
These main background system threads in Hotspot JVM are mainly the following:
Virtual machine threads: the operation of this thread requires the JVM to reach a safe point before it occurs. The reason these operations have to happen in different threads is that they all need JVM to reach a safe point so that the heap does not change. The execution types of this thread include garbage collection of "stop-the-world", thread stack collection, thread suspension, and partial lock revocation.
Periodic task threads: these threads are the embodiment of time cycle events (such as interrupts), and they are generally used to schedule the execution of periodic operations.
GC threads: this thread provides support for different kinds of garbage collection behavior in JVM.
Compile thread: this thread compiles the bytecode to local code at run time.
Signal scheduling thread: this thread receives the signal and sends it to the JVM and processes it internally by calling the appropriate method.
Thank you for your reading. the above is the content of "what is the Runtime data area". After the study of this article, I believe you have a deeper understanding of what is the Runtime data area. The specific use also needs to be verified by practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.