Table of Contents
1. Overview of Java virtual machine
2. Java Virtual Machine Family
3. Java virtual machine execution process
Home Java javaTutorial Detailed overview of Java virtual machine

Detailed overview of Java virtual machine

Jun 20, 2017 pm 02:35 PM
java Overview structure virtual

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");
    }

}
Copy after login

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 of this Website
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

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1662
14
PHP Tutorial
1262
29
C# Tutorial
1235
24
Break or return from Java 8 stream forEach? Break or return from Java 8 stream forEach? Feb 07, 2025 pm 12:09 PM

Java 8 introduces the Stream API, providing a powerful and expressive way to process data collections. However, a common question when using Stream is: How to break or return from a forEach operation? Traditional loops allow for early interruption or return, but Stream's forEach method does not directly support this method. This article will explain the reasons and explore alternative methods for implementing premature termination in Stream processing systems. Further reading: Java Stream API improvements Understand Stream forEach The forEach method is a terminal operation that performs one operation on each element in the Stream. Its design intention is

PHP: A Key Language for Web Development PHP: A Key Language for Web Development Apr 13, 2025 am 12:08 AM

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

PHP vs. Python: Understanding the Differences PHP vs. Python: Understanding the Differences Apr 11, 2025 am 12:15 AM

PHP and Python each have their own advantages, and the choice should be based on project requirements. 1.PHP is suitable for web development, with simple syntax and high execution efficiency. 2. Python is suitable for data science and machine learning, with concise syntax and rich libraries.

PHP vs. Other Languages: A Comparison PHP vs. Other Languages: A Comparison Apr 13, 2025 am 12:19 AM

PHP is suitable for web development, especially in rapid development and processing dynamic content, but is not good at data science and enterprise-level applications. Compared with Python, PHP has more advantages in web development, but is not as good as Python in the field of data science; compared with Java, PHP performs worse in enterprise-level applications, but is more flexible in web development; compared with JavaScript, PHP is more concise in back-end development, but is not as good as JavaScript in front-end development.

PHP vs. Python: Core Features and Functionality PHP vs. Python: Core Features and Functionality Apr 13, 2025 am 12:16 AM

PHP and Python each have their own advantages and are suitable for different scenarios. 1.PHP is suitable for web development and provides built-in web servers and rich function libraries. 2. Python is suitable for data science and machine learning, with concise syntax and a powerful standard library. When choosing, it should be decided based on project requirements.

Top 10 virtual currency trading platforms in the 2025 cryptocurrency circle Top 10 virtual currency trading platforms in the 2025 cryptocurrency circle Mar 12, 2025 pm 05:27 PM

Top 10 virtual currency trading platforms in the 2025 cryptocurrency circle: 1. OKX, known for its high liquidity, low fees and abundant products; 2. Binance, one of the world's largest exchanges, with a huge user base; 3. Gate.io, a veteran exchange, safe and stable; 4. Kraken, focusing on professional traders, safe and compliant; 5. Huobi Global, a world-renowned, strong technical strength; 6. Coinbase, a leading exchange in the United States, easy to use compliance; 7. KuCoin, rich trading pairs, low fees.

PHP's Impact: Web Development and Beyond PHP's Impact: Web Development and Beyond Apr 18, 2025 am 12:10 AM

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

PHP: The Foundation of Many Websites PHP: The Foundation of Many Websites Apr 13, 2025 am 12:07 AM

The reasons why PHP is the preferred technology stack for many websites include its ease of use, strong community support, and widespread use. 1) Easy to learn and use, suitable for beginners. 2) Have a huge developer community and rich resources. 3) Widely used in WordPress, Drupal and other platforms. 4) Integrate tightly with web servers to simplify development deployment.

See all articles