当前位置:网站首页>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 、 management
The 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
边栏推荐
- What is generics and the use of generics in collections [easy to understand]
- [in depth understanding of tcapulusdb technology] tcapulusdb model
- 【深入理解TcaplusDB技术】单据受理之建表审批
- RMAN备份数据库_管理备份窗口(Backup Window)
- connect to address IP: No route to host
- 十大券商的排名是?手机开户安全么?
- 【深入理解TcaplusDB技术】TcaplusDB导入数据
- 【深入理解TcaplusDB技术】单据受理之表管理
- Dell R530内置热备盘状态变化说明
- 【深入理解TcaplusDB技术】TcaplusDB常规单据
猜你喜欢
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
【深入理解TcaplusDB技术】创建游戏区
.NET Worker Service 添加 Serilog 日志记录
安装spark + 用命令运行scala相关项目 + crontab定时执行
【深入理解TcaplusDB技术】Tmonitor后台一键安装
. Net worker service adding a serial log record
【深入理解TcaplusDB技术】集群管理操作
[in depth understanding of tcapulusdb technology] tcapulusdb operation and maintenance doc
使用宝塔来进行MQTT服务器搭建
揭秘GES超大规模图计算引擎HyG:图切分
随机推荐
视觉SLAM十四讲 第9讲 卡尔曼滤波
Matlab中图形对象属性gca使用
How to develop the hash quiz game system? Hash quiz game system development application details case and source code
. How to exit net worker service gracefully
OSError: Unable to open file (truncated file: eof = 254803968, sblock->base_addr = 0, stored_eof = 2
The stacks 2022:32 marketing technology stacks selected
Skills to master in advanced development
Computing architecture of microblog comments
【深入理解TcaplusDB技术】TcaplusDB常规单据
【深入理解TcaplusDB技术】TcaplusDB构造数据
实际开户复杂吗?在线开户安全么?
篇4:win10安装MingW64
解析数仓lazyagg查询重写优化
RMAN backup database_ Restart RMAN backup
QT generate random numbers (random strings) within the specified range
【深入理解TcaplusDB技术】Tmonitor系统升级
【深入理解TcaplusDB技术】单据受理之创建业务指南
Using QT to make a beautiful login interface box
Sword finger offer double pointer
中断操作:AbortController学习笔记