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

原创 2004年09月15日 09:30:00

What is a Java Virtual Machine?

To understand the Java virtual machine you must first be aware that you may be talking about any of three 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, using the same concrete implementation, 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

Inside the Java virtual machine, threads come in two flavors: daemon and non- daemon. A daemon thread is ordinarily a thread used by the virtual machine itself, such as a thread that performs garbage collection. The application, however, can mark any threads it creates as daemon threads. The initial thread of an application--the one that begins at main()--is a non- daemon thread.

java虚拟机内存不足,“Could not create the Java Virtual Machine”问题解决方案

java虚拟机内存不足,“Could not create the Java Virtual Machine”问题解决方案   在运行java程序时,遇到问题"Could not create...
  • c_c123
  • c_c123
  • 2016年05月12日 09:43
  • 2002

【转】断电或强制退出后VMware虚拟机出现The virtual machine appears to be in use无法启动问题解决

一、产生问题的原理  到相应的虚拟机目录下删除%虚拟机名字%.vmx.lck文件夹或者其中的文件即可         遇见:         我们打开任务管理器,会发现v...
  • roler_
  • roler_
  • 2014年06月16日 21:23
  • 1310

Apache Spark探秘:利用Intellij IDEA构建开发环境

前段时间写了几篇使用Eclipse构建Spark源码阅读和开发环境的文章。经过一段时间的试用,发现Eclipse在Scala支持方面很不完善,体验非常差,因此转而使用Intellij IDEA,本...
  • shuhuai007
  • shuhuai007
  • 2014年07月10日 09:07
  • 1815

java认证专员测试题(英文版) java basic (附答案)

·1·  The OCA JP 7 Exam (1)  Java Basic  Time: 33 minutes                                         ...
  • u013400503
  • u013400503
  • 2014年02月13日 12:00
  • 1080

机器学习界大牛林达华推荐的书籍(Recommended Books)

Here is a list of books which I have read and feel it is worth recommending to friends who are inter...
  • zhongwen7710
  • zhongwen7710
  • 2015年03月04日 23:35
  • 1569


1.  What are the valid components of a Java source file (choose all that apply):(abcd) a package st...
  • u013438987
  • u013438987
  • 2014年02月10日 19:44
  • 434

Chrome 设置使用已安装JRE的方式

情况描述 此状况发生在Chrome 的较旧的版本上: 机器已经安装过JRE 或是JDK, 但是每次打开Chrome 浏览器使用Applet时, 会报需要下载JRE的提示信息(最新的JRE1.7...
  • oscar999
  • oscar999
  • 2013年06月13日 11:00
  • 33613

CentOS7.1 KVM虚拟化之linux虚拟机安装(2)

一、上传ISO文件到/data/iso下 这里使用CentOS-5.5-i386-bin-DVD.iso 二、安装CentOS5.5 CentOS7.1 安装KVM虚拟机默认磁盘格式为qcow2(推荐...
  • hnhuangyiyang
  • hnhuangyiyang
  • 2016年03月11日 12:47
  • 5150


  • subfate
  • subfate
  • 2015年05月06日 13:00
  • 2653


自制Java虚拟机(五)实现继承、多态、invokevirtual本篇文章将研究如何实现面向对象的继承和多态特性,同时实现invokevirtual。一、实例属性的继承继承实现了数据与方法的复用。 类...
  • chunyuan314
  • chunyuan314
  • 2017年06月07日 19:12
  • 515
您举报文章:JVM - Concept and Lifetime (From book "Inside the Java Virtual Machine")