当前位置:网站首页>Jvm-jvm overview
Jvm-jvm overview
2022-07-22 19:01:00 【Learn from Tao Ge】
Basic introduction
JVM: Full name Java Virtual Machine, namely Java virtual machine , A specification , Itself is a virtual computer , Interact directly with the operating system , No direct interaction with hardware , And the operating system can help us complete the work of interacting with hardware
characteristic :
- Java Virtual machines are based on Binary bytecode perform , By a set of bytecode instructions 、 A set of registers 、 A stack 、 A garbage collection heap 、 A method area, etc
- JVM Information related to the operating system platform is masked , So as to make Java The program only needs to be generated in JVM Bytecode file running on , Achieved through this mechanism Cross-platform sex
Java Code execution process :Java Program --( compile )--> Bytecode file --( Explain to perform )--> operating system (Win,Linux)
JVM structure :

JVM、JRE、JDK contrast :
- JDK(Java SE Development Kit):Java Standard development kit , Provides compilation 、 function Java The various tools and resources required for a program
- JRE( Java Runtime Environment):Java Running environment , Used to interpret execution Java Bytecode file

Reference books :https://book.douban.com/subject/34907497/
Reference video :https://www.bilibili.com/video/BV1PJ411n7xZ
Reference video :https://www.bilibili.com/video/BV1yE411Z7AP
Architectural model
Java The instruction stream input by the compiler is a stack based instruction set architecture . Because of the cross platform design ,Java The instructions of are designed according to the stack , Different platforms CPU Different architectures , Therefore, it cannot be designed based on register architecture
- Based on the characteristics of plank structure :
- Simple design and implementation , For systems with limited resources
- Use zero address instruction to assign , The execution process depends on the operation stack , The instruction set is smaller , The compiler is easy to implement
- Zero address instruction : A kind of machine instruction , It is an instruction without address field in the instruction system , There is only operation code but no address code . There are two cases of this kind of instruction : One is that no operands are needed , The other is that the operands are default ( The implicit ), The default is that the operand is in the register (ACC) in , Instructions have direct access to registers
- An address instruction : An operation code corresponds to an address code , Find the operand through the address code
- No hardware support required , Better portability , Better cross platform
- Based on the characteristics of register architecture :
- Need hardware support , Poor portability
- Better performance , More efficient execution , Registers are faster than memory
- Command with an address 、 2. Address instruction 、 3. Address instruction is the main
Life cycle
JVM The life cycle of is divided into three stages , Respectively : start-up 、 function 、 Death
start-up : When a Java The program , By booting the class loader (bootstrap class loader) Create an initial class (initial class), For possession main The class of the function is JVM Starting point of instance running
function :
main() Method is the initial starting point of a program , Any thread can be started here by
stay JVM There are two thread types inside , Respectively : User threads and daemons ,JVM The daemon thread is used ,main() And other threads use user threads , The daemon thread will end with the end of the user thread
Execute one Java The program , What is really being implemented is a Java Process of virtual machine
JVM There are two modes of operation Server And Client, The difference between the two models is :Client Mode starts faster ,Server Mode starts slowly ; But after a long period of stable operation Server Mode is faster than Client Much faster
Server Mode enabled JVM It's a heavyweight virtual machine , More optimizations of the program ;Client Mode enabled JVM It's a lightweight virtual machine
Death :
- When all user threads in the program are terminated ,JVM You're going to quit
- The normal execution of the program ends 、 The program terminates abnormally due to an exception or error 、 An operating system error caused the to terminate
- Thread calls Runtime class halt Method or System class exit Method , also Java The security manager allows this exit or halt operation
边栏推荐
- 程序员面试金典面试题 01.04. 回文排列
- strncpy() 复制字符串(受长度限制)
- PCV、PIL、Pillow安装
- Leetcode 693. alternating bit binary number
- Leetcode 304. two dimensional area and retrieval - matrix immutable
- 写作单词积累
- pytorch自定义dataloder的时候,返回参数
- Domestic ngrok achieves intranet penetration
- LeetCode 693. 交替位二进制数
- Wechat scans the QR code of the website, but only displays the link address, and cannot jump to the web page
猜你喜欢
paper - A Physics-based Noise Formation Model for Extreme Low-light Raw Denoising
mysql主从复制
Important knowledge points of go language: string, UTF-8 encoding, Rune
PCV、PIL、Pillow安装
JUC-同步器
Flink learning notes (V) datastream API
程序员面试金典面试题 01.02. 判定是否互为字符重排
Leetcode 105. constructing binary trees from preorder and inorder traversal sequences
Strncpy() copy string (limited by length)
BigDecimal中除法divide()方法的详细解析,带你走进源码的world
随机推荐
Strncpy() copy string (limited by length)
JVM-JVM概述
paper - A Physics-based Noise Formation Model for Extreme Low-light Raw Denoising
6-2-depth first search underground maze exploration (30 points)
PTA search tree judgment
Thymeleaf中一个页面怎么嵌套另一个页面,关于页面嵌套,标签告诉你应该知道的
Go language learning: go language journey - exercise questions and reference answers
fucking-algorithm
1. Package and release procedure of QT (NSIS);
Vlfeat, pydot configuration
1. The solution of line feed qt5- "vs" in constants; 2. Problems and solutions of common compilation of QT and vs of the same code
JVM-系统优化
Ways of data optimization
After the project is started, the mapper XML file is loaded circularly
用LaTeX写论文时如何加资助信息
Pat basic problem set 7-26 word length (simplified code)
PAT乙级1010一元多项式求导(题意理解)
Upgrade win10sp1 to the latest version; Qt5.9.6 static compilation (network is valid)
Flink learning notes (III) Flink installation and deployment
Pat class B 1010 univariate polynomial derivation (problem meaning understanding)