当前位置:网站首页>Quickly understand JVM structure and working principle
Quickly understand JVM structure and working principle
2022-06-28 08:42:00 【ZhiXiongWu】
Quickly understand JVM Structure and working principle
What is? Java virtual machine (JVM)?
Java Virtual machine is an executable Java Virtual machine process of bytecode , Equivalent to a normal application .Java Source files are compiled to be able to be Java Bytecode file executed by virtual machine . java To execute on the application platform , You need to install and execute the virtual machine first ,java The virtual machine shields the underlying hardware information of the platform operating system , It extracts and sorts out the common processing hardware interfaces of each platform and provides them to the development users ,java Development users only need to be based on JVM Development interface development java Program without paying attention to the system characteristics of the execution platform .
If JAVA Metaphorical train , The virtual machine can be understood as a track . It is JAVA A permissive carrier of . by JAVA Provides the operating environment . Cross platform is because virtual machines can run on multiple platforms . therefore JAVA You can run on multiple platforms . This is also JAVA One of the advantages and characteristics of . Running across platforms .
JVM Structure
JVM Loading subsystems by classes , Actuator engine , Local method libraries and runtime areas ( Memory space ) form . Here we will focus on the memory space .
JVM The memory space of is :
- Pile up ( Threads share )
- Method area ( Threads share )
- Virtual machine stack ( Thread private )
- Native Method Stack ( Thread private )
- Program counter ( Thread private )
What are these places doing .
Pile up ( Threads share )
JVM All our instantiated objects are stored in the heap .
Method area ( Threads share )
It mainly stores the class information loaded by the virtual machine , Constant , Static variables , Constant pool
JVM Stack ( Thread private )
Save the stack frame allocated by the calling method when our program runs , Include local variable table ( The required space is allocated at compile time , The size after allocation cannot be changed )、 The stack of operands 、 Dynamic links 、 Method export, etc .
Local stack ( Thread private )
And JVM Like a stack , Only the service objects are different ,JVM In the service of Java Method , The local stack serves the virtual machine Native Method .
Program counter ( Thread private )
This memory is small , It is mainly responsible for recording the line number and position of bytecode when the bytecode interpreter works . For example, the multithreading switch of our program , It is necessary to determine through this counter , So each thread has its own program counter .
JVM How it works
This section is easy to understand , You can have a simple understanding of it like me , We will not explain the specific implementation too much .
First Java The program has been compiled , Generate class Format file , And this class File is what our virtual machine needs , The virtual machine loads class File to run our Java Program . There is also a special point to be made here .JVM Not only can it run Java Program !JVM Not only can it run Java Program !JVM Not only can it run Java Program ! In the same way, the original design did not intend to make the virtual machine run only Java Program , It can also run programs in other languages . I won't search specifically , You can learn by yourself if you need to know .
Make a note of it , deficiencies , Please supplement .
边栏推荐
- Comment supprimer le crosstalk SiC MOSFET?
- Not so Mobile
- Key points of building fire protection design
- Not so Mobile
- 叠加阶梯图和线图及合并线图和针状图
- Superimposed ladder diagram and line diagram and merged line diagram and needle diagram
- Why MySQL cannot insert Chinese data in CMD
- [cloud native | kubernetes] in depth understanding of pod (VI)
- Discussion on the improvement and application of the prepayment system in the management of electricity charge and price
- Anniversary party
猜你喜欢
随机推荐
AWS builds a virtual infrastructure including servers and networks (2)
nuxt3入门
containerd1.5.5的安装
Login common test case
Idea related issues
AWS saves data on the cloud (3)
Anniversary party
Anniversary party
Ffmpeg streaming fails to update header with correct duration
抖音服务器带宽有多大,才能供上亿人同时刷?
RAC enable archive log
叠加阶梯图和线图及合并线图和针状图
整数划分
Guangzhou: new financial activities and new opportunities for enterprises
[learning notes] search
Build the first neural network with pytoch and optimize it
Dell r730 server startup error: [xxx] USB 1-1-port4: disabled by hub (EMI?), re-enabling...
Robot Rapping Results Report
40多岁的人如何配置年金险?哪款产品比较合适?
Zhejiang energy online monitoring and management system



![[learning notes] matroid](/img/e3/4e003f5d89752306ea901c70230deb.png)





