当前位置:网站首页>Preliminary understanding of JVM
Preliminary understanding of JVM
2022-06-25 16:23:00 【Hurry to Friday】
jvm A preliminary understanding
JNI(java native interface) java Local interface :
Concept : JNI yes java Part of the language , Can pass JNI And other languages (C,C++) Interaction
JNI Provides JAVA A functional interface between a program and an operating system ,
Application scenarios :
1. When the program is performance sensitive , It is necessary to use a lower level language .
2. In the case that other languages have already implemented functions ,java It can be called directly .
3. When needed java Operating system dependent features that are not available
Use steps :
1. stay java Statement in the program native Method , Compile into a bytecode file (class)
2. use java Program , take class File generation header file ( command :java -jni xxx )
3. Implement... In other languages native Method , Generate dynamic library , for java Program usage
4. Release java Dynamic library
native keyword :
1.native The method of modification indicates that the method is not JAVA The realization of language , It is implemented in other languages , Out-of-service abstract To decorate , Because this method has a method body, but it just doesn't use java Language implementation .
java Program compiled into bytecode file ,jvm When executing bytecode files , The bytecode file will be interpreted into different machine instructions according to different operating systems , So as to achieve cross platform .
Program counter : It records the address of the virtual machine bytecode instruction being executed , Bytecode interpreter obtains the next bytecode instruction to be executed by changing the value of the program counter , Small memory space , Threads are private .
Virtual machine stack : Thread private , Life cycle is the same as thread , Describe the java Memory model for method execution : Each method creates a stack frame at execution time , Used to store local variable table , The stack of operands , Dynamic links , Method exit information . Each method is called from the end of the call , It corresponds to a stack frame from the virtual machine to the stack
Local variable table : All kinds of basic types known at compile time are stored (boolean、byte、char、short、int、float、long、double)、 Object reference (reference type ) and returnAddress type ( Points to the address of a bytecode instruction )
Native Method Stack : Different from virtual machine stack ,java The virtual machine stack is for java Method served , The local method stack is used for the virtual machine native Method served .
Pile up : Is part of thread sharing , Used to store object instances and arrays ,
Method area : It belongs to the shared memory area , Used to store class information loaded by virtual machine , Constant , Static variables , Just-in-time compiler compiled code and so on

Virtual machine stack , Program counter , The three memory areas of the local method stack are symbiotic with threads , The stack in the stack frame performs the operations of entering and exiting the stack as the method enters and exits . The heap and method areas are different , Is shared by threads , An interface may have multiple implementation classes , And each implementation class needs different memory , Only when the program is running can we know which implementation class to create ( And runtime type ), This part of the memory allocation and recycling are dynamic , By the garbage collector (GC) be responsible for .
Class loader :
The class loader is responsible for class Bytecode files are loaded into memory , And transform these contents into the method area , The class loader is only responsible for putting class Bytecode file loading , Not responsible for running , As for whether it can run , Determined by the execution engine .
Classification of class loaders :( Three + User customization )
1. Start class loader Bootstrap class loader(c++)
2. Extend the classloader Extension class loader(java)
3. Application class loader App class loader
User defined class loader ( Realization java.lang.ClassLoad Realization ) This is an abstract class
Parent delegate mechanism : When a class loader needs to load a class , I won't try to load this class myself . Instead, first delegate the parent class loader to load , Then the class loader that receives the delegate will also follow this rule , First, delegate your own parent class to try to load this class . Finally, it will be delegated to the startup class to load . When the required class is not found in the parent class loader , Subclasses try to load themselves .
The benefits of the parental delegation mechanism are : Sandbox security mechanism , It can ensure that the same class loads the same object .
边栏推荐
- 报错:homebrew-core is a shallow clone
- How to reload the win10 app store?
- The style of the mall can also change a lot. DIY can learn about it!
- The release of autok3s v0.5.0 continues to be simple and friendly
- DINO: DETR with Improved DeNoising Anchor Boxes for End-to-End Object Detection翻译
- Blue Bridge Cup - practice system login
- 说下你对方法区演变过程和内部结构的理解
- Stop "outsourcing" Ai models! The latest research finds that some "back doors" that undermine the security of machine learning models cannot be detected
- Problems caused by using ApplicationContext to render layout
- leetcode-8. 字符串转换整数 (atoi)
猜你喜欢

教务系统开发(PHP+MySQL)

Geographic location data storage scheme - redis Geo

赫尔辛基交通安全改善项目部署Velodyne Lidar智能基础设施解决方案
Introduction to database transactions

Lifeifei's team applied vit to the robot, increased the maximum speed of planning reasoning by 512 times, and also cued hekaiming's MAE

Swift responsive programming

Sleep formula: how to cure bad sleep?

Rxjs TakeUntil 操作符的学习笔记

心樓:華為運動健康的七年築造之旅

Based on neural tag search, the multilingual abstracts of zero samples of Chinese Academy of Sciences and Microsoft Asiatic research were selected into ACL 2022
随机推荐
[untitled]
One minute to familiarize yourself with the meaning of all fluent question marks
After flutter was upgraded from 2.2.3 to 2.5, the compilation of mixed projects became slower
The database records are read through the system time under the Android system, causing the problem of incomplete Reading Records!
商城风格也可以很多变,DIY 了解一下!
Uniapp converts graphic verification codes in the form of file streams into images
Overall MySQL architecture and statement execution process
Helsinki traffic safety improvement project deploys velodyne lidar Intelligent Infrastructure Solution
Gold three silver four, an article to solve the resume and interview
Practice of geospatial data in Nepal graph
Navicat Premium 15 for Mac(数据库开发工具)中文版
Collection overview, array encapsulation
Deadlock, thread communication, singleton mode
不要小看了积分商城,它的作用可以很大!
Take you to the open source project of smart home: the preliminary configuration of zhiting home cloud and home assistant+ homebridge
MT60B1G16HC-48B:A美光内存颗粒FBGA代码D8BNK[通俗易懂]
面试官:你简历上说精通mysql,那你说下聚簇/联合/覆盖索引、回表、索引下推
Golang open source streaming media audio and video network transmission service -lal
Message format of Modbus (PLC)
DINO: DETR with Improved DeNoising Anchor Boxes for End-to-End Object Detection翻译