当前位置:网站首页>[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 .
边栏推荐
- Is it safe to buy funds on Alipay account
- The R language dplyr package rowwise function and mutate function calculate the maximum value of multiple data columns in each row in the dataframe data, and generate the data column (row maximum) cor
- 深度学习数学基础
- promise 和 Observable 的区别
- R language ggplot2 visual Facet: gganimate package is based on Transition_ Time function to create dynamic scatter animation (GIF)
- 文字编辑器 希望有错误的句子用红色标红,文字编辑器用了markdown
- R语言ggplot2可视化:gganimate包创建动态柱状图动画(gif)、使用transition_states函数在动画中沿给定维度逐步显示柱状图
- 如何设置VSCode删除整行快捷键?
- SLC、MLC、TLC 和 QLC NAND SSD 之间的区别:哪个更好?
- @Component cannot get Dao layer
猜你喜欢

夜神模擬器+Fiddler抓包測試App

呆错图床系统源码图片CDN加速与破J防盗链功能

新加坡暑假旅游攻略:一天玩转新加坡圣淘沙岛

Leetcode (81) -- search rotation sort array II

UML 类图

医院在线问诊源码 医院视频问诊源码 医院小程序源码

The text editor hopes to mark the wrong sentences in red, and the text editor uses markdown
![[daily question] first day](/img/8c/f25cddb6ca86d44538c976fae13c6e.png)
[daily question] first day

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

How to enable the run dashboard function of idea
随机推荐
R language uses Cox of epidisplay package Display function obtains the summary statistical information of Cox regression model (risk rate HR, adjusted risk rate and its confidence interval, P value of
Is it safe to buy funds on Alipay account
Leetcode(154)——寻找旋转排序数组中的最小值 II
Google's official response: we have not given up tensorflow and will develop side by side with Jax in the future
LightGroupButton* sender = static_cast<LightGroupButton*>(QObject::sender());
哪个券商公司网上开户佣金低又安全又可靠
在Tensorflow2中使用mnist_784数据集进行手写数字识别
全链路数字化转型下,零售企业如何打开第二增长曲线
拦截器与过滤器的区别
Mini Golf Course: a good place for leisure and tourism in London
2022编译原理期末考试 回忆版
链游系统开发(Unity3D链游开发详情)丨链游开发成熟技术源码
迷你高尔夫球场:伦敦休闲旅游好去处
深度学习数学基础
sql训练2
@Component 拿不到dao层
2022软件工程期末考试 回忆版
Yesterday, Alibaba senior wrote a responsibility chain model, and there were countless bugs
FastDFS安装
The student Tiktok publicized that his alma mater was roast about "reducing the seal of enrollment". Netizen: hahahahahahahaha