当前位置:网站首页>[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 .
边栏推荐
- Responses of different people in technology companies to bugs | daily anecdotes
- reduce--遍历元素计算 具体的计算公式需要传入 结合BigDecimal
- 工业软件讲堂-三维CAD设计软件的核心技术解析----讲坛第二次讲座
- UML class diagram
- UML 类图
- Typical application of "stack" - expression evaluation (implemented in C language)
- Ali was wildly asked by the interviewer on three sides. Redis dared not write 'proficient' on his resume anymore
- [Yugong series] July 2022 go teaching course 001 introduction to go language premise
- What are the links of the problem
- 在纽约寻找童真——新泽西州乐高乐园探索中心的美好一天
猜你喜欢
医院在线问诊源码 医院视频问诊源码 医院小程序源码
一款简约PHP个人发卡程序V4.0版本
在纽约寻找童真——新泽西州乐高乐园探索中心的美好一天
电商系统中常见的 9 大坑,你踩过没?
深度学习数学基础
Leetcode (81) -- search rotation sort array II
[fluent] dart data type (VaR data type | object data type)
Leetcode(81)——搜索旋转排序数组 II
300+ documents! This article explains the latest progress of multimodal learning based on transformer
Mysql高级篇学习总结6:索引的概念及理解、B+树产生过程详解、MyISAM与InnoDB的对比
随机推荐
Thoroughly understand the point cloud processing tutorial based on open3d!
LightGroupButton* sender = static_ cast<LightGroupButton*>(QObject::sender());
Responses of different people in technology companies to bugs | daily anecdotes
2022软件工程期末考试 回忆版
Google's official response: we have not given up tensorflow and will develop side by side with Jax in the future
如何设置VSCode删除整行快捷键?
Redis (6) -- object and data structure
Ali was wildly asked by the interviewer on three sides. Redis dared not write 'proficient' on his resume anymore
Uncover the whole link communication process of dewu customer service im
The text editor hopes to mark the wrong sentences in red, and the text editor uses markdown
What is cloud primordial? This time, I can finally understand!
链游系统开发(Unity3D链游开发详情)丨链游开发成熟技术源码
Typical application of "stack" - expression evaluation (implemented in C language)
学习八股文的知识点~~1
LightGroupButton* sender = static_cast<LightGroupButton*>(QObject::sender());
Web version 3D visualization tool, 97 things programmers should know, AI frontier paper | information daily # 2022.07.01
Mysql高级篇学习总结6:索引的概念及理解、B+树产生过程详解、MyISAM与InnoDB的对比
[daily question] the next day
Deep neural network Summary
Stratégie touristique d'été de Singapour: un jour pour visiter l'île de San taosha à Singapour