当前位置:网站首页>03 runtime data area overview and threads
03 runtime data area overview and threads
2022-06-25 18:22:00 【Name is too tangled】
1. summary
This section focuses on the runtime data area , That's the part below , It's in the stage after class loading is complete

class File passing through classloader subsystem ( load –> link –> initialization ) Three steps of , After the loading , The method area in memory holds the runtime class itself , Next, use the execution engine to execute , All processes executed by the execution engine need
Run time data area

Memory
- Memory is a very important system resource , It's hard disk and CPU Middle warehouse and Bridge , It carries the real-time operation of the operating system and application program
- JVM The memory layout defines Java At run time
Memory application 、 Distribute 、 managementThe strategy of , To ensure the JVM Efficient and stable operation of Different JVM There are some differences between memory partition and management mechanism. combination JVM Virtual machine specification , Let's talk about the classic JVM Memory layout- We use disks or networks IO Data obtained , All need to be loaded into memory first , then CPU Get data from memory for reading
Run time data area


Detailed explanation
Java Virtual machine defines several kinds of runtime data areas that will be used during program running , Some of them will be created as the virtual machine starts , Destroy with virtual machine exit . Others correspond to threads one by one , These data regions corresponding to the thread are created and destroyed as the thread starts and ends .
The gray one is Individual threads are private , The red one is Shared by multiple threads . namely :
- Thread unique : Independence includes
Program counter、Stack、Native Method Stack、 - Sharing between threads :
Pile up 、 Out of heap memory ( Permanent generation or meta space 、 Code cache )
About sharing between threads

Every JVM only one Runtime example . That is, runtime environment , Equivalent to the middle frame of the memory structure : Runtime environment .
2. Threads
2.1 Threads
- A thread is a running unit in a program .
JVM Allows an application to have multiple threads executing in parallel - stay Hotspot JVM in , Each thread is mapped directly to the local thread of the operating system
- When one Java When the thread is ready to execute , At this time, a local thread of the operating system is also created .Java After thread execution is terminated , Local threads also recycle
- The operating system is responsible for scheduling threads to any available CPU On .
Once the local thread is initialized successfully , It's going to call Java In thread run( ) Method - If a thread throws an exception , And this thread is the last non daemon thread in the process , Then the virtual machine will stop
When JVM When all threads in are daemons ,JVM You can quit ; If there is one or more non daemon threads, they will not exit.( The above is for normal exit , call System.exit Will exit )
2.2 JVM System threads
- 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 calls public static void main(String [ ]) Of main Threads and all of them are created by this main Method creates its own thread- These are the main background system threads ( The guardian thread ) stay Hotspot JVM There are mainly the following :
- Virtual machine threads : This kind of thread operation needs JVM The safety point will be reached . The reason these operations have to happen in different threads is that they all need JVM Reach safety point , So the pile doesn't change . The execution types of this thread include "stop-the-world" Garbage collection , Thread stack collection , Thread suspension and biased lock revocation
- Periodic task thread : This thread is the embodiment of time cycle events ( Like interruptions ), They are generally used for scheduling execution of periodic operations
- GC Threads : This kind of thread pair is in JVM There are different kinds of garbage collection behaviors that support ( a key )
- Compile thread : This thread will compile bytecode into Native code
- Signal scheduling thread : This thread receives signals and sends them to JVM, Inside it, it's handled by calling the appropriate method
边栏推荐
- Video production material website arrangement
- [in depth understanding of tcapulusdb technology] tcapulusdb operation and maintenance
- JVM understanding
- The stacks 2022:32 marketing technology stacks selected
- 【深入理解TcaplusDB技术】如何实现Tmonitor单机安装
- JVM problem replication
- Qi v1.2.4协议 之 定频调压方案
- Anaconda download Tsinghua source
- Trample hole record -- a series of coincidences caused by thread pool rejection policy
- Pycharm 使用过程中碰到问题
猜你喜欢

Using QT to make a beautiful login interface box

158_模型_Power BI 使用 DAX + SVG 打通制作商业图表几乎所有可能

Wechat applet reports an error: request:fail URL not in domain list

LeetCode力扣(剑指offer 26-30)26. 树的子结构 27. 二叉树的镜像 28. 对称的二叉树 29. 顺时针打印矩阵 30. 包含min函数的栈

使用宝塔来进行MQTT服务器搭建

篇4:win10安装MingW64

General message publishing and subscription in observer mode

Kwai 616 war report was launched, and the essence was thrown away for the second time to lead the new wave. Fast brand jumped to the top 3 of the hot list
![There is a repeating element iii[pruning with ordered ordering]](/img/26/5c3632a64945ea3409f8240ef5b18a.png)
There is a repeating element iii[pruning with ordered ordering]

【深入理解TcaplusDB技术】TcaplusDB业务数据备份
随机推荐
The stacks 2022:32 marketing technology stacks selected
Pycharm 使用过程中碰到问题
安装spark + 用命令运行scala相关项目 + crontab定时执行
Skills to master in advanced development
C ASP, net core framework value transfer method and session use
GNU nano
JVM problem replication
Matlab中图形对象属性gca使用
【深入理解TcaplusDB技术】 Tmonitor模块架构
Lazy singleton mode from shallow to deep
Hash of redis command
【深入理解TcaplusDB技术】TcaplusDB业务数据备份
C generic class case
One article solves all search backtracking problems of Jianzhi offer
【深入理解TcaplusDB技术】Tmonitor后台一键安装
跨境电商亚马逊、eBay、Shopee、Lazada、速卖通、沃尔玛、阿里国际等平台,怎样进行自养号测评更安全?
158_ Model_ Power Bi uses DAX + SVG to open up almost all possibilities for making business charts
General message publishing and subscription in observer mode
【深入理解TcaplusDB技术】单据受理之表管理
What is an operator?