Read Java virtual machine thoroughly! (JVM)

Xia Mu Jin Su 2021-01-24 15:25:45
read java virtual machine thoroughly

mention Java virtual machine (JVM), Probably most people's first impression “ difficult ”, But let's really walk in “JVM The world ” When , We will find that the problem is not as complicated as we thought . The only thing that really scares us , It's the fear itself . But as a whole JVM The first in a series , This article will take you through the beginning of learning JVM When a variety of doubts . such as : What is? JVM? Why study JVM? How to study effectively JVM? Take these questions with you , Let's walk in together JVM In the world! .

 Read the article thoroughly Java virtual machine !(JVM)

One 、 Why study JVM?

Study JVM There are several reasons :

1、 Application tuning

Different procedures ( Business scenario ) Need different Jvm To configure , For example, set different garbage collectors 、 Set the memory configuration and proportion of the new generation and old generation , Different configurations have very different effects on the execution of a program . and Jvm The default configuration only guarantees that the program can “ function ”, And want to “ It works fine ” Even “ Better run ”, Is learning Jvm One of the most important factors .

2、 Troubleshoot program running problems

Some programs may encounter all kinds of problems when they are used online , And these problems are often fatal , Like a memory leak , Deadlock causes the program to run slowly, etc , These problems are easily overlooked during the development and small concurrent testing phases , So study Jvm At a critical time , Help you clean up the system when you're in danger “ ills ”.

3、 Master the fundamental and principle of program execution

That's what a lot of people say : Not only should “ Know what it is ”, still more “ Know why ”.

4、 To avoid errors in writing code

For example, avoid overloading calls to variable-length parameters ( Specific cases will be given in the following articles ).

5、 To cope with the interview

I have to say that's one of the things that a lot of people study for , It is also a positive force , If you understand “ Catfish effect ” Words .

6、 Master the general mechanics of other languages

JVM There is also a strong point , It doesn't just work Java Program , It also works Scala、Clojure、Groovy, And what's hot right now Kotlin, Study JVM You can then understand the general mechanics of these languages , Even allowing these languages to share ecosystems .

Two 、 What is? JVM?

JVM brief introduction : JVM yes Java Virtual Machine Abbreviation , Chinese translation for Java virtual machine , Is a specification for computing equipment , It's an imaginary computer , It is realized by simulating various computer functions on a real computer . Simply speaking JVM It's for parsing and running Java programmatic .

Java There is a very important feature “ Platform independence ”, Is the use of JVM Realized .Java The language just needs to be generated Jvm Object code running on ( Bytecode ), It can run unmodified on multiple platforms , because JVM It blocks platform-specific information , bring Java can “ A compilation , Run anywhere ”.

3、 ... and 、 How to study effectively JVM?

So that's learning JVM Benefits of , But how to learn effectively JVM Well ? Someone might see it “JVM” perhaps “Java virtual machine ” These few words are muddled , I don't know what it is , Not to mention how . And this section is going to teach you how to learn effectively. Right JVM, hold JVM Make a division of knowledge points . so to speak , Master the following listed knowledge points , You have the whole thing JVM.

JVM Knowledge points of , Divided into the following :

1、 JVM The composition of

Only to understand JVM Component part , To calculate the real understanding JVM,JVM The composition of 5 Parts of : Pile up 、 Virtual machine stack 、 Native Method Stack 、 Program counter 、 Method area , This will be covered in the following articles 5 The specific purpose of each part .

2、 Multiple garbage collection algorithms

Jvm There are a lot of garbage collection algorithms , Different algorithms have different advantages and disadvantages , such as : Tag clearing algorithm and replication algorithm 、 A clearly marked algorithm produces a variety of space debris 、 The replication algorithm divides the memory into two pieces , Although the performance is very good but can only use one at a time , Wasted memory space , There's no perfect algorithm ? The answer is yes , Because of the space , More on that later in the article .

3、 Multiple garbage collectors

Jvm There are many garbage collectors , For example, the earliest version of the serial collector Serial, Development of the oldest collector , It is a new generation collector using replication algorithm , It is a single-threaded collector , It's doing garbage collection , All other worker threads must be suspended , until Serial Collector collection ends (“Stop The World”). also CMS(Concurrent Mark Sweep) A collector is one that aims to obtain the shortest recovery pause time ; There are more advanced ones G1(Garbage-First) The collector etc. .

Learn about these collectors , One is to configure the appropriate collector for your program , On the other hand, each collector has different Settings , After learning the configuration of these collectors , You can set optimal run matching parameters for your program .

4、 JVM Analysis tools

Jvm Analysis tools are used to troubleshoot bugs in a running program , Find out what's wrong with the program , In order to ensure the stable operation of the program ,Jvm Analyzers are divided into : Command line tools ( Officially, it's an experimental tool , But stability is not in doubt ), There are also view analysis tools , The former is certainly superior to the latter , But the latter is based on the former , Each of these tools will be explained in more detail later in this series .

5、 Java Class loading mechanism

Java Class loading mechanism , It's about Java The class in Jvm Load and run mechanism in , To understanding Java How does it work that helps a lot , This is also learning Java Very interesting point , You can see Java The whole process of running , It's completely transparent , Give a person a kind of “ Sense of control ”, This is a Java Language is inherently supportive , So it feels like Java This language is very interesting .

6、JVM Commonly used optimized configuration

Study Jvm The biggest benefit is actually , Use Jvm These common configurations , Make your program run more efficiently , So it is essential for this aspect of learning .


This article leads you to the right Jvm The overall impression has the preliminary understanding , got it Jvm Learning can bring us benefits , as well as Jvm How to learn , And these questions are just beginning to be learned Jvm Is the biggest obstacle . Everything is difficult at the beginning , Well begun is half done , Congratulations on your study Java An indispensable skill in your field .

 Read the article thoroughly Java virtual machine !(JVM)

If you want to learn for free (Java engineering 、 High performance and distributed 、 Microservices 、Spring,MyBatis,Netty Source code analysis ) Can add programmers Java Advanced group :875511259, In the group, Ali Daniu explained the sharing technology , And large Internet technology videos , We all share it for free .
本文为[Xia Mu Jin Su]所创,转载请带上原文链接,感谢

  1. 【计算机网络 12(1),尚学堂马士兵Java视频教程
  2. 【程序猿历程,史上最全的Java面试题集锦在这里
  3. 【程序猿历程(1),Javaweb视频教程百度云
  4. Notes on MySQL 45 lectures (1-7)
  5. [computer network 12 (1), Shang Xuetang Ma soldier java video tutorial
  6. The most complete collection of Java interview questions in history is here
  7. [process of program ape (1), JavaWeb video tutorial, baidu cloud
  8. Notes on MySQL 45 lectures (1-7)
  9. 精进 Spring Boot 03:Spring Boot 的配置文件和配置管理,以及用三种方式读取配置文件
  10. Refined spring boot 03: spring boot configuration files and configuration management, and reading configuration files in three ways
  11. 精进 Spring Boot 03:Spring Boot 的配置文件和配置管理,以及用三种方式读取配置文件
  12. Refined spring boot 03: spring boot configuration files and configuration management, and reading configuration files in three ways
  13. 【递归,Java传智播客笔记
  14. [recursion, Java intelligence podcast notes
  15. [adhere to painting for 386 days] the beginning of spring of 24 solar terms
  16. K8S系列第八篇(Service、EndPoints以及高可用kubeadm部署)
  17. K8s Series Part 8 (service, endpoints and high availability kubeadm deployment)
  18. 【重识 HTML (3),350道Java面试真题分享
  19. 【重识 HTML (2),Java并发编程必会的多线程你竟然还不会
  20. 【重识 HTML (1),二本Java小菜鸟4面字节跳动被秒成渣渣
  21. [re recognize HTML (3) and share 350 real Java interview questions
  22. [re recognize HTML (2). Multithreading is a must for Java Concurrent Programming. How dare you not
  23. [re recognize HTML (1), two Java rookies' 4-sided bytes beat and become slag in seconds
  24. 造轮子系列之RPC 1:如何从零开始开发RPC框架
  25. RPC 1: how to develop RPC framework from scratch
  26. 造轮子系列之RPC 1:如何从零开始开发RPC框架
  27. RPC 1: how to develop RPC framework from scratch
  28. 一次性捋清楚吧,对乱糟糟的,Spring事务扩展机制
  29. 一文彻底弄懂如何选择抽象类还是接口,连续四年百度Java岗必问面试题
  30. Redis常用命令
  31. 一双拖鞋引发的血案,狂神说Java系列笔记
  32. 一、mysql基础安装
  33. 一位程序员的独白:尽管我一生坎坷,Java框架面试基础
  34. Clear it all at once. For the messy, spring transaction extension mechanism
  35. A thorough understanding of how to choose abstract classes or interfaces, baidu Java post must ask interview questions for four consecutive years
  36. Redis common commands
  37. A pair of slippers triggered the murder, crazy God said java series notes
  38. 1、 MySQL basic installation
  39. Monologue of a programmer: despite my ups and downs in my life, Java framework is the foundation of interview
  40. 【大厂面试】三面三问Spring循环依赖,请一定要把这篇看完(建议收藏)
  41. 一线互联网企业中,springboot入门项目
  42. 一篇文带你入门SSM框架Spring开发,帮你快速拿Offer
  43. 【面试资料】Java全集、微服务、大数据、数据结构与算法、机器学习知识最全总结,283页pdf
  44. 【leetcode刷题】24.数组中重复的数字——Java版
  45. 【leetcode刷题】23.对称二叉树——Java版
  46. 【leetcode刷题】22.二叉树的中序遍历——Java版
  47. 【leetcode刷题】21.三数之和——Java版
  48. 【leetcode刷题】20.最长回文子串——Java版
  49. 【leetcode刷题】19.回文链表——Java版
  50. 【leetcode刷题】18.反转链表——Java版
  51. 【leetcode刷题】17.相交链表——Java&python版
  52. 【leetcode刷题】16.环形链表——Java版
  53. 【leetcode刷题】15.汉明距离——Java版
  54. 【leetcode刷题】14.找到所有数组中消失的数字——Java版
  55. 【leetcode刷题】13.比特位计数——Java版
  56. oracle控制用户权限命令
  57. 三年Java开发,继阿里,鲁班二期Java架构师
  58. Oracle必须要启动的服务
  59. 万字长文!深入剖析HashMap,Java基础笔试题大全带答案
  60. 一问Kafka就心慌?我却凭着这份,图灵学院vip课程百度云