当前位置:网站首页>[100 cases of JVM tuning practice] 01 - introduction of JVM and program counter
[100 cases of JVM tuning practice] 01 - introduction of JVM and program counter
2022-07-02 19:00:00 【Half old 518】
front said
Author's brief introduction : Half old 518, Long distance runner , Determined to persist in writing 10 Blog of the year , Focus on java Back end
Column Introduction : Case driven introduction JVM knowledge , Teach you how to use JVM Troubleshooting 、 Evaluation code 、 Optimize performance
The article brief introduction : Introduce JVM The role of 、JVM、JRE、JDK The difference between , common JVM And JVM Learning route
List of articles
1.JVM brief introduction
1.1 JVM The role of
JVM Its function is as follows :
- Write once , Run everywhere
- Automatic memory management , Garbage collection
- Array subscript out of bounds check , If the memory allocation method of array subscript out of bounds is allowed , Then there may be content coverage , therefore JVM It provides a supporting mechanism for array subscript out of bounds checking .
- Provide polymorphic underlying support . The virtual method table holds the actual entry address of each method . If a method is not overridden in a subclass , The address entry in the virtual method table of that subclass is the same as the address entry of the same method of the parent class , All point to the actual entry address of the parent class . If a subclass overrides this method , The address in the subclass method table will be replaced with the entry address pointing to the subclass implementation version .
1.2 JVM、JRE、JDK
Differences among the three 、 The contact is shown in the figure below .
1.3 common JVM
JVM Comply with a series of specifications , If necessary , You can develop one yourself JVM, Many large companies have their own JVM, common JVM The following table . Its underlying implementation is different , We will focus on Hotspot Explain .
1.4 JVM Learning route of
Here's the picture ,JVM It mainly includes three parts : Class loader ,JVM Memory structure and execution engine . A class is compiled , There must be a classloader to load . Class is placed in the method area , The instance object of the class is placed on the heap , Objects in the heap will use the virtual machine stack when calling methods 、 Program counter and local method stack . Method execution , Each line of code is interpreted and executed by the program interpreter in the execution engine , Hot code in method ( Call... Frequently ) Will be JIT Just in time compiler for optimized compilation ,GC Is responsible for garbage collection of objects that are no longer referenced in the heap . Sometimes JVM You also need to interact with the operating system , The local method interface is responsible for this responsibility . Learning will follow the order from easy to difficult , The following icon notes learn : Study first JVM Memory structure , Introducing the process of garbage collection , To learn java The build process ( Such as optimization ), Then learn the process of class loading and common class loaders , Finally, it introduces the optimization of program runtime , That is, the interpreter and the immediate compiler .
2. Program counter
effect :
The function of the program counter is to remember the next execution of the program jvm Address of instruction . In the computer java The process from code to execution is : Source code to bytecode , Binary bytecode to jvm Instructions , Give it to the interpreter , The interpreter obtains the bytecode address to be interpreted through the program counter , Convert instructions into machine code , from CPU perform ; At the same time, the program counter moves to the next instruction to be executed .java It's multi-threaded , It is the program counter that ensures that if the thread is lost cpu, Recapture cpu The post interpreter can know where the next instruction to be executed is .

The program counter has the following characteristics :
Thread private , Each thread has its own program counter , Record where the current thread code is executed .
java The only part of the virtual machine that will not have memory overflow .
边栏推荐
- R语言dplyr包filter函数筛选dataframe数据、如果需要筛选的数据列(变量)名称中包含引号则需要使用!!sym语法处理、否则因为无法处理引号筛选不到任何数据
- Slam | how to align timestamps?
- How to delete the border of links in IE? [repeat] - how to remove borders around links in IE? [duplicate]
- The student Tiktok publicized that his alma mater was roast about "reducing the seal of enrollment". Netizen: hahahahahahahaha
- After 22 years in office, the father of PowerShell will leave Microsoft: he was demoted by Microsoft for developing PowerShell
- R language uses lrtest function of epidisplay package to perform likelihood ratio test on multiple GLM models (logisti regression). Compare whether the performance of the two models is different, and
- 学生抖音宣传母校被吐槽“招生减章”,网友:哈哈哈哈哈哈
- Leetcode (81) -- search rotation sort array II
- Yesterday, Alibaba senior wrote a responsibility chain model, and there were countless bugs
- 在支付宝账户上买基金安全吗
猜你喜欢

全链路数字化转型下,零售企业如何打开第二增长曲线

【JVM调优实战100例】01——JVM的介绍与程序计数器

Mysql高级篇学习总结7:Mysql数据结构-Hash索引、AVL树、B树、B+树的对比

故障排查:kubectl报错ValidationError: unknown field \u00a0

彻底搞懂基于Open3D的点云处理教程!

LightGroupButton* sender = static_cast<LightGroupButton*>(QObject::sender());

Tips for material UV masking

After 22 years in office, the father of PowerShell will leave Microsoft: he was demoted by Microsoft for developing PowerShell

M2dgr: slam data set of multi-source and multi scene ground robot (ICRA 2022)

昨天阿里学长写了一个责任链模式,竟然出现了无数个bug
随机推荐
如何清理废弃pv和其对应的文件夹
R language dplyr package Na_ The if function converts the control in the vector value into the missing value Na, and converts the specified content into the missing value Na according to the mapping r
Simulateur nightGod + application de test de capture de paquets Fiddler
任职 22 年,PowerShell 之父将从微软离职:曾因开发 PowerShell 被微软降级过
MySQL about only_ full_ group_ By limit
Tips for material UV masking
Mysql高级篇学习总结6:索引的概念及理解、B+树产生过程详解、MyISAM与InnoDB的对比
Websocket of Web real-time communication technology
How to use PS to extract image color and analyze color matching
【JVM调优实战100例】02——虚拟机栈与本地方法栈调优五例
医院在线问诊源码 医院视频问诊源码 医院小程序源码
Yesterday, Alibaba senior wrote a responsibility chain model, and there were countless bugs
CDN acceleration and breaking J anti-theft chain function
Uncover the whole link communication process of dewu customer service im
How to play when you travel to Bangkok for the first time? Please keep this money saving strategy
Comprendre complètement le tutoriel de traitement de Point Cloud basé sur open3d!
Eliminate the yellow alarm light on IBM p750 small computer [easy to understand]
徹底搞懂基於Open3D的點雲處理教程!
Web实时通信技术之Websocket
Redis(7)----数据库与过期键