search
HomeJavajavaTutorialDetailed overview of Java virtual machine
Detailed overview of Java virtual machineJun 20, 2017 pm 02:35 PM
javaOverviewstructurevirtual

1. Overview of Java virtual machine

The Java technology system officially defined by Oracle mainly includes the following parts:

  • Java Programming Language

  • Java virtual machine for various platforms

  • Class file format

  • Java API class Library

  • Third-party Java class library

The three parts of Java programming language, Java virtual machine and Java API class library can be collectively referred to as JDK (Java Development Kit), which is the minimum environment for Java program development. In addition, the Java SE API subset and Java virtual machine in the Java API are collectively called JRE (Java Runtime Environment), which is the standard environment for Java programs to run.

The reason why the Java virtual machine is called "virtual" is because it is just an abstract computer defined by a specification.

2. Java Virtual Machine Family

Many students may think that the Java virtual machine is just a virtual machine. Does it have a family? Or think that the Java virtual machine refers to Oracle's HotSpot virtual machine. Here is a brief introduction to the Java virtual machine family. Since the Sun Classic VM included in JDK1.0 released by Sun in 1996 to today, many types of virtual machines have appeared and disappeared. Here we will only briefly introduce the relatively mainstream Java virtual machines that currently exist. .

HotSpot VM
The virtual machines that come with Oracle JDK and OpenJDK are the most mainstream and widely used Java virtual machines. Technical articles introducing the Java virtual machine, unless otherwise specified, most of them introduce HotSpot VM. HotSpot VM was not developed by Sun, but was designed by Longview Technologies, a small company. It was acquired by Sun in 1997, and Sun was acquired by Oracle in 2009.
J9 VM
J9 VM is a VM developed by IBM and is currently its main development Java virtual machine. The market positioning of J9 VM is close to that of HotSpot VM. It is a multi-purpose virtual machine designed with everything from server to desktop application to embedded in mind. The current performance level of J9 VM is roughly on the same level as HotSpot VM.
Zing VM
Based on Oracle's HotSpot VM, many details that affect latency have been improved. The three biggest selling points are:

  • 1. Low latency, "no pause" C4 GC, the pause caused by GC can be controlled below 10ms, and the supported Java heap size Can reach 1TB;

  • #2. Quick warm-up function after startup.

  • 3. Manageability: Zing Vision, a monitoring tool integrated into the JVM that has zero overhead and can be turned on at all times in the production environment.

3. Java virtual machine execution process

When we execute a Java program, what is its execution process? As shown below.

As you can see from the above figure, the Java virtual machine has no necessary connection with the Java language. It is only related to a specific binary file: the Class file..

4.Java virtual machine structure

The architecture mentioned here refers to the abstract behavior of the Java virtual machine, rather than the specific implementation of HotSpot VM. . According to the Java virtual machine specification, the abstract Java virtual machine is shown in the figure below.

##JVM = classloader classloader + execution engine execution engine + runtime data area runtime data area

. classloader loads the class file on the hard disk into the runtime data area in the JVM, but it is not responsible for whether the class file can be executed, and this is the responsibility of the execution engine .

The Java virtual machine abstract specification is just a concept. Generally speaking, the Java virtual machine is a specific implementation of the specification. This implementation may come from multiple providers and exist on multiple platforms. It can be implemented entirely in software, or in a combination of hardware and software.

5. The life cycle of the virtual machine

The bounden duty of a runtime Java virtual machine instance is: responsible for running a java program.

When a Java program is started, a virtual machine instance is born. When the program is closed and exited, the virtual machine instance will also die

. If three Java programs are run simultaneously on the same computer, three Java virtual machine instances will be obtained. Each Java program runs in its own Java virtual machine instance. A Java virtual machine instance runs a Java program by calling the main() method of an initial class. The main() method must be public, static, return void, and accept a string array as a parameter. Any class with such a main() method can be used as the starting point for running a Java program.

public class Test {public static void main(String[] args) {// TODO Auto-generated method stubSystem.out.println("Hello World");
    }

}

In the above example, the main() method in the initial class of the Java program will be used as the starting point of the initial thread of the program, and any other threads are started by this initial thread.

There are two kinds of threads inside the Java virtual machine: daemon threads and non-daemon threads. Daemon threads are usually used by the virtual machine itself, such as threads that perform garbage collection tasks. However, a Java program can also mark any thread it creates as a daemon thread. The initial thread in the Java program - the one that starts in main(), is a non-daemon thread.

As long as there are any non-daemon threads running, the Java program will continue to run. When all non-daemon threads in the program terminate, the virtual machine instance will automatically exit . If the security manager allows it, the program itself can also exit by calling the exit() method of the Runtime class or the System class.

The above is the detailed content of Detailed overview of Java virtual machine. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
带你搞懂Java结构化数据处理开源库SPL带你搞懂Java结构化数据处理开源库SPLMay 24, 2022 pm 01:34 PM

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于结构化数据处理开源库SPL的相关问题,下面就一起来看一下java下理想的结构化数据处理类库,希望对大家有帮助。

Java集合框架之PriorityQueue优先级队列Java集合框架之PriorityQueue优先级队列Jun 09, 2022 am 11:47 AM

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于PriorityQueue优先级队列的相关知识,Java集合框架中提供了PriorityQueue和PriorityBlockingQueue两种类型的优先级队列,PriorityQueue是线程不安全的,PriorityBlockingQueue是线程安全的,下面一起来看一下,希望对大家有帮助。

完全掌握Java锁(图文解析)完全掌握Java锁(图文解析)Jun 14, 2022 am 11:47 AM

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于java锁的相关问题,包括了独占锁、悲观锁、乐观锁、共享锁等等内容,下面一起来看一下,希望对大家有帮助。

一起聊聊Java多线程之线程安全问题一起聊聊Java多线程之线程安全问题Apr 21, 2022 pm 06:17 PM

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于多线程的相关问题,包括了线程安装、线程加锁与线程不安全的原因、线程安全的标准类等等内容,希望对大家有帮助。

详细解析Java的this和super关键字详细解析Java的this和super关键字Apr 30, 2022 am 09:00 AM

本篇文章给大家带来了关于Java的相关知识,其中主要介绍了关于关键字中this和super的相关问题,以及他们的一些区别,下面一起来看一下,希望对大家有帮助。

Java基础归纳之枚举Java基础归纳之枚举May 26, 2022 am 11:50 AM

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于枚举的相关问题,包括了枚举的基本操作、集合类对枚举的支持等等内容,下面一起来看一下,希望对大家有帮助。

java中封装是什么java中封装是什么May 16, 2019 pm 06:08 PM

封装是一种信息隐藏技术,是指一种将抽象性函式接口的实现细节部分包装、隐藏起来的方法;封装可以被认为是一个保护屏障,防止指定类的代码和数据被外部类定义的代码随机访问。封装可以通过关键字private,protected和public实现。

归纳整理JAVA装饰器模式(实例详解)归纳整理JAVA装饰器模式(实例详解)May 05, 2022 pm 06:48 PM

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于设计模式的相关问题,主要将装饰器模式的相关内容,指在不改变现有对象结构的情况下,动态地给该对象增加一些职责的模式,希望对大家有帮助。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!