Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the knowledge points of JVM?

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces "what are the knowledge points of JVM". In the daily operation, I believe many people have doubts about the knowledge points of JVM. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the questions of "what are the knowledge points of JVM?" Next, please follow the editor to study!

1. What is JVM? Where?

JVM is the abbreviation of Java Virtual Machine (Java Virtual Machine). JVM is a specification for computing devices. It is a fictional computer, which is realized by simulating various computer functions on a real computer.

Baidu's explanation is foggy, for us Java programmers, to put it plainly:

JVM is essentially a program that recognizes a .class bytecode file (which stores the binary code we compiled for .java), parses its instructions, and finally calls functions on the operating system to do what we want!

About the cross-platform nature of the Java language, because of JVM, we can think of it as an abstraction layer, as long as the abstraction layer JVM correctly executes .class files, it can run on a variety of operating systems! This is to compile once and run many times.

For the location of JVM:

JVM runs on the operating system and has no direct interaction with the hardware.

2. The relationship between JVM, JRE and JDK.

JDK (Java Development Kit): Java Development Kit

JRE (Java Runtime Environment): Java runtime environment

Instruction tools such as JDK = JRE + javac/java/jar

JRE = JVM + Java basic class library

3. JVM architecture Java virtual machine is mainly divided into five modules:

‍ class loader subsystem

Runtime data area

Executive engine

Local method interface

Garbage collection module

The method area is a special kind of heap

There will be no garbage in the stack, and it will pop up after using it, otherwise it will block the main method.

Almost all the garbage is in the heap, so JVM performance tuning% 99 is targeted at the heap

4. Three kinds of JVM (understand)

HotSpot of Sun (we all use this)

BEA company JRockitIBM company J9 VM5, class loader

Function: load .Class bytecode file

1. Review the process of new object public class Student {

/ / Private attribute

Private String name

/ / Construction method

Public Student (String name) {

This.name = name

}

}

The class is the template and the template is abstract; the object is concrete and instantiates the abstraction

/ / at run time, JVM puts the information of Test into the method area

Public class Test {

/ / the main method itself is put into the method area

Public static void main (String [] args) {

/ / S1, S2, S3 are different objects

Student S1 = new Student ("zsr"); / / references are placed on the stack and specific instances are placed on the heap

Student S2 = new Student ("gcc")

Student S3 = new Student ("BareTH")

System.out.println (s1.hashCode ())

System.out.println (s2.hashCode ())

System.out.println (s3.hashCode ())

/ / class1, class2 and class3 are the same object

Class

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report