当前位置:网站首页>[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 .
边栏推荐
- [daily question] the next day
- 链游系统开发(Unity3D链游开发详情)丨链游开发成熟技术源码
- How to delete the border of links in IE? [repeat] - how to remove borders around links in IE? [duplicate]
- Is it safe to buy funds on Alipay account
- Redis (7) -- database and expiration key
- Responses of different people in technology companies to bugs | daily anecdotes
- 27: Chapter 3: develop Passport Service: 10: [registration / login] interface: after the registration / login is OK, save the user session information (uid, utoken) to redis and cookies; (one main poi
- Typical application of "stack" - expression evaluation (implemented in C language)
- R语言dplyr包na_if函数把向量数值中的控制转化为缺失值NA、按照映射规则把指定内容转化为缺失值NA
- R语言使用epiDisplay包的lsNoFunction函数列出当前空间中的所有对象、除了用户自定义的函数对象
猜你喜欢
UML class diagram
彻底搞懂基于Open3D的点云处理教程!
一款简约PHP个人发卡程序V4.0版本
医院在线问诊源码 医院视频问诊源码 医院小程序源码
STM32G0 USB DFU 升级校验出错-2
300+ documents! This article explains the latest progress of multimodal learning based on transformer
【每日一题】第一天
Looking for innocence in New York -- a beautiful day at the discovery center of Legoland, New Jersey
M2dgr: slam data set of multi-source and multi scene ground robot (ICRA 2022)
徹底搞懂基於Open3D的點雲處理教程!
随机推荐
Redis(6)----对象与数据结构
“栈”的典型应用—表达式求值(C语言实现)
拦截器与过滤器的区别
【JVM调优实战100例】01——JVM的介绍与程序计数器
@Component 拿不到dao层
【每日一题】第二天
Mini Golf Course: a good place for leisure and tourism in London
SAP S/4HANA OData Mock Service 介绍
R语言ggplot2可视化:可视化折线图、使用labs函数为折线图添加自定义的X轴标签信息
如何优雅的写 Controller 层代码?
Industrial software lecture - core technology analysis of 3D CAD design software - the second lecture of the Forum
元宇宙链游系统开发(逻辑开发)丨链游系统开发(详细分析)
Responses of different people in technology companies to bugs | daily anecdotes
Is it safe to buy funds on Alipay account
第一次去曼谷旅游怎么玩?这份省钱攻略请收好
Introduction to sap s/4hana OData mock service
Web实时通信技术之Websocket
Chain game system development (unity3d chain game development details) - chain game development mature technology source code
阿里三面被面试官狂问Redis,简历上再也不敢写'精通'了
Mysql高级篇学习总结8:InnoDB数据存储结构页的概述、页的内部结构、行格式