JVM - Concept and Lifetime (from book "Inside the Java Virtual Machine)

xiaoxiao2021-03-06  54

What is a java virtual machine?

To Understand The Java Virtual Machine You Must First Be Aware That You May DiffERENT Things When You Say "Java Virtual Machine." You May Be Speaking of:

The Abstract Specification, A Concrete Implementation, or a runtime instance.

The abstract specification is a concept. Concrete implementations, which exist on many platforms and come from many vendors, are either all software or a combination of hardware and software. A runtime instance hosts a single running Java application.

Each Java Application Runs Inside A Runtime Instance of Some Concrete IMPLEMENTATION OF THE Abstract Specification of the Java Virtual Machine.

The Lifetime of A Java Virtual Machine

A runtime instance of the Java virtual machine has a clear mission in life: to run one Java application When a Java application starts, a runtime instance is born When the application completes, the instance dies If you start three Java applications at the... Same Time, ON The Same Computer, You'll Get Three Java Virtual Machine Instances. Each Java Application Runs Inside Its OWN Java Virtual Machine.

A Java Virtual Machine Instance Starts Running Its Solitary Application By Invoking The Main () Method of Some Initial Class.

A Java application continues to execute (the virtual machine instance continues to live) as long as any non-daemon threads are still running. When all * non-daemon * threads of a Java application terminate, the virtual machine instance will exit. If permitted By The Security Manager, The Application Can Also Cause Its Own Demise by Invoking The Exit () Method of Class Runtime Or System.

Daemon and Non-daemon thread

转载请注明原文地址:https://www.9cbs.com/read-116901.html

New Post(0)