Java JVM 和 HotSpot 的区别?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16568253/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Difference between JVM and HotSpot?
提问by Justin
What exactly is HotSpot and how does it relate to JVM and OpenJDK? Is it a library? What exactly does it do?
HotSpot 究竟是什么,它与 JVM 和 OpenJDK 有什么关系?是图书馆吗?它究竟有什么作用?
Also, what is the difference between OpenJDK and HotSpot?
另外,OpenJDK 和 HotSpot 有什么区别?
采纳答案by Edwin Dalorzo
The definition of what exactly is a Java Virtual Machine is stated in the Java Virtual Machine Specification
Java 虚拟机规范中对什么是 Java 虚拟机的定义进行了说明
The JVM is by definition a virtual machine, i. e. a software machine that simulates what a real machine does. Like a real machine, it has an instruction set, a virtual computer architecture and an execution model. It is capable of running code written with this virtual instruction set, pretty much like a real machine can run machine code.
根据定义,JVM 是一个虚拟机,即模拟真实机器所做工作的软件机器。就像一台真正的机器,它有一个指令集、一个虚拟计算机架构和一个执行模型。它能够运行用这个虚拟指令集编写的代码,就像一台真正的机器可以运行机器代码一样。
HotSpotis an an implementation of the JVM concept. It was originally developed by Sun and now it is owned by Oracle. There are other implementations of the JVM specification, like JRockit, IBM J9, among many others.
HotSpot是 JVM 概念的一种实现。它最初由 Sun 开发,现在归 Oracle 所有。JVM 规范还有其他实现,例如JRockit、IBM J9等。
See List of Java Virtual Machine Implementations
请参阅Java 虚拟机实现列表
The OpenJDKis a project under which an opensource implementation of HotSpot (and many other pieces of the JDK e.g compiler, APIs, tools, etc) is developed.
在OpenJDK的是其下热点(和其他许多件JDK如编译器,应用程序接口,工具等)的开源实现开发的一个项目。
回答by NINCOMPOOP
OpenJDK(Open Java Development Kit) is a free and open source implementation of the Java Platform, Standard Edition (Java SE).The openjdk is a project started by Sun Microsystems, nowadays care by many companies and the community for build a Java Development Kit absolutely in open source. As per the official documentation.
OpenJDK(Open Java Development Kit) 是 Java Platform, Standard Edition (Java SE) 的免费开源实现。 openjdk 是 Sun Microsystems 发起的一个项目,现在很多公司和社区都关心构建 Java Development Kit绝对是开源的。根据官方文档。
OpenJDK is an open-source implementation of the Java Platform, Standard Edition (Java SE) specifications. In May 2007, Sun released a fully buildable Java Development Kit (JDK) version for Java SE to the OpenJDK Community as free software under the GNU General Public License version two (GPLv2). Sun announced the Interim Governing Board for the OpenJDK community. Sun also announced that OpenJDK-based implementations can use the Java SE 6 Technical Compatibility Kit (JCK) to establish compatibility with the Java SE 6 specification.
OpenJDK 是 Java 平台标准版 (Java SE) 规范的开源实现。2007 年 5 月,Sun 向 OpenJDK 社区发布了一个完全可构建的 Java SE 的 Java 开发工具包 (JDK) 版本,作为 GNU 通用公共许可证第二版 (GPLv2) 下的免费软件。Sun 宣布了 OpenJDK 社区的临时管理委员会。Sun 还宣布基于 OpenJDK 的实现可以使用 Java SE 6 Technical Compatibility Kit (JCK) 来建立与 Java SE 6 规范的兼容性。
The OpenJDK projectconsists of a number of components - HotSpot (the virtual machine), the Java Class Library and the javac Java compiler.For more on it, visit its site.
在OpenJDK项目包括多个组件的-热点(虚拟机)中,Java类库和javac的Java的compiler.For更多关于它,请访问其网站。
The current JVM provided by Sun/Oracle is called HotSpotbecause it seeks hot spots of use in the code (places where code is more intensively used) for "just-in-time" optimization. From the wikipedia, HotSpot, released as the "Java HotSpot Performance Engine" is a Java virtual machine for desktops and servers, maintained and distributed by Oracle Corporation.
Sun/Oracle 提供的当前 JVM 被称为HotSpot,因为它在代码中寻找使用热点(代码使用更密集的地方)以进行“即时”优化。来自维基百科,作为“Java HotSpot 性能引擎”发布的 HotSpot 是一种用于桌面和服务器的 Java 虚拟机,由 Oracle Corporation 维护和分发。
回答by Edwin Dalorzo
HotSpot is, as mentioned above, a cross-platform implementation of the Java Virtual Machine (JVM) Concept, and is distributed with the OpenJDK (Java Developer Kit), under the GNU General Public License. HotSpot is written mainly in C++, and was originally developed under Sun Microsystems. It is currently developed under the OpenJDK Project, at www.java.net. The HotSpot JVM was available as an add-on for Java 1.2, and later was used as the default Sun JVM in Java 1.3. The JVM is currently in Version 7, Build b147, and has an active development community behind it.
如上所述,HotSpot 是 Java 虚拟机 (JVM) 概念的跨平台实现,并在 GNU 通用公共许可证下与 OpenJDK(Java 开发人员工具包)一起分发。HotSpot 主要用 C++ 编写,最初是在 Sun Microsystems 下开发的。它目前是在 OpenJDK 项目下开发的,位于 www.java.net。HotSpot JVM 作为 Java 1.2 的附加组件提供,后来在 Java 1.3 中用作默认的 Sun JVM。JVM 目前处于版本 7,Build b147,并且背后有一个活跃的开发社区。
For more information, goto: https://www.java.net/
更多信息,请访问:https: //www.java.net/
Happy Coding!
快乐编码!
回答by Premraj
JVM is an abstract machine (specifications). HotSpot, OpenJDK and JRockit and so are implementations of JVM.
JVM 是一个抽象机器(规范)。HotSpot、OpenJDK 和 JRockit 等都是 JVM 的实现。
Free and open source implementations
免费和开源实现
HotSpot, the primary reference Java VM implementation
OpenJDK— Open Java Development Kit is a free and open source implementation licensed under the GNU General Public License (GNU GPL) with a linking exception.
HotSpot,主要参考 Java VM 实现
OpenJDK— Open Java Development Kit 是一个免费的开源实现,在 GNU 通用公共许可证 (GNU GPL) 下获得许可,但有一个链接例外。
Proprietary implementations
专有实现
- JRockit(originally from Appeal Virtual Machines) acquired by Oracle for Linux, Windows and Solaris
- JRockit(最初来自 Appeal Virtual Machines)被 Oracle 收购,用于 Linux、Windows 和 Solaris
for more implementations
linkexplains differences between HotSpot and JRocket
回答by Dawg
HotSpot is an advanced form of C++ hacking, in order to use it you must build against it in order to compile even the simplest of things. Unless you tune compilers and or write them from scratch. HotSpot is basically a way of converting source code into C++ code and then compiling it to native code thus the term jit compiled.
HotSpot 是 C++ hacking 的一种高级形式,为了使用它,您必须针对它进行构建,以便编译即使是最简单的东西。除非您调整编译器或从头开始编写它们。HotSpot 基本上是一种将源代码转换为 C++ 代码,然后将其编译为本地代码的方法,因此术语 jit 已编译。
回答by Basil Bourque
Difference between JVM and HotSpot?
JVM 和 HotSpot 的区别?
A Java Virtual Machine (JVM)is an imaginary computer that has never been physically built as hardware. A JVM runs programs compiled to its imaginary instruction setwritten to storage as an intermediate representationknown as bytecode.
一个Java虚拟机(JVM)是从未被物理建成硬件假想计算机。JVM 运行编译成其虚构指令集的程序,该指令集作为称为字节码的中间表示写入存储。
At runtime, the bytecode must be translated from the imaginary instruction set to the actual instruction set of the CPU of the host machine. This can be done on-the-fly by an interpreter. Or the bytecode can be fully compiled and cached, to run faster than through the interpreter, in a process known as Just-In-Time (JIT) compiling.
在运行时,字节码必须从虚构的指令集转换为主机 CPU 的实际指令集。这可以由口译员即时完成。或者字节码可以被完全编译和缓存,以比通过解释器运行得更快,在一个称为即时 (JIT) 编译的过程中。
Over the decades, there have been many implementations of the JVM. Most have fallen away.
几十年来,有许多JVM 的实现。大多数都已经消失了。
HotSpotis one implementation of JIT technology that starts by running interpreted, and watches the actual performance of the app. Parts of the app are then selected to be fully-compiled as native code and cached, for much faster execution. HotSpot was developed at Sunas a commercial product. After acquiring Sun, Oraclefurther evolved HotSpot by combining important parts of their competing product, JRockit. HotSpot is now open-sourced through the OpenJDKproject, available free-of-charge.
HotSpot是 JIT 技术的一种实现,它从运行解释开始,并观察应用程序的实际性能。然后选择应用程序的某些部分作为本机代码完全编译并缓存,以便更快地执行。HotSpot 是在Sun作为商业产品开发的。收购 Sun 后,Oracle通过结合其竞争产品JRockit 的重要部分进一步发展 HotSpot。HotSpot 现在通过OpenJDK项目开源,免费提供。
Another such implementation in OpenJ9, developed by IBM, and now open-sourced through the Eclipse Foundationand available free-of-charge. Some JVM distributions built on OpenJDK replace HotSpot with OpenJ9 while still using the rest of OpenJDK such as the Java SEclass libraries. For example, the pre-built distributions available at AdoptOpenJDKprovide your choice of HotSpotor OpenJ9on some hardware.
OpenJ9 中的另一个这样的实现,由 IBM 开发,现在通过Eclipse Foundation开源并免费提供。一些基于 OpenJDK 的 JVM 发行版将 HotSpot 替换为 OpenJ9,同时仍然使用 OpenJDK 的其余部分,例如Java SE类库。例如,AdoptOpenJDK提供的预构建发行版在某些硬件上为您提供了HotSpot或OpenJ9 的选择。
Diagram showing history of HotSpot & JRockit merging, and OpenJ9 both available in AdoptOpenJDK.
图表显示了 HotSpot 和 JRockit 合并的历史,以及在 AdoptOpenJDK 中可用的 OpenJ9。
What exactly is HotSpot and how does it relate to JVM and OpenJDK? Is it a library? What exactly does it do?
HotSpot 究竟是什么,它与 JVM 和 OpenJDK 有什么关系?是图书馆吗?它究竟有什么作用?
- HotSpotis an implementation of the part of a JVM that interprets and/or compiles Java bytecode to be executed on the host CPU.
- OpenJ9is an alternative.
OpenJ9is generally known for much faster starting and much lower memory usage initially, while HotSpotmay run more efficiently overall for long-running apps. Both are well-regarded, well-worn, and available with distributions of OpenJDK.
OpenJ9通常以更快的启动速度和更低的内存使用量而闻名,而HotSpot可能会更有效地运行长时间运行的应用程序。两者都广受好评,久经考验,并且可用于 OpenJDK 的发行版。
OpenJDKis an open-source project that fully implements the Java Specifications, JSRs, and JEPs that define the Java platform. Every JVM implementation I know of today is based entirely or mostly on the OpenJDK codebaseand uses either HotSpot or OpenJ9 technology.
OpenJDK是一个开源项目,它完全实现了定义Java 平台的Java 规范、JSR和JEP。我今天所知道的每个 JVM 实现都完全或大部分基于 OpenJDK代码库,并使用 HotSpot 或 OpenJ9 技术。
Besides the JVM, OpenJDK also provides an implementation in source code for all classes required by the Java SE specifications, such as java.lang, java.util, java.time, and other packages.
除了 JVM,OpenJDK 还为 Java SE 规范所需的所有类(例如java.lang、java.util、java.time和其他包)提供了源代码中的实现。
Also, what is the difference between OpenJDK and HotSpot?
另外,OpenJDK 和 HotSpot 有什么区别?
The source code for HotSpotis housed, maintained, and further developed as part of the OpenJDKproject. The alternative, OpenJ9, is housed, maintained, and further developed at the Eclipse Foundation, while replacing HotSpot in some distributions of OpenJDK.
HotSpot的源代码作为OpenJDK项目的一部分进行保存、维护和进一步开发。替代方案OpenJ9由Eclipse Foundation容纳、维护和进一步开发,同时取代了 OpenJDK 的某些发行版中的 HotSpot。
Some distributions of Java technology choose to ship with HotSpot. Some distributions choose to substitute the portion of the OpenJDKcodebase that is HotSpotwith the alternative, OpenJ9.
Java 技术的一些发行版选择随 HotSpot 一起提供。一些发行版选择将OpenJDK代码库中的HotSpot部分替换为OpenJ9替代品。
Here is a flowchart graphic to help you choose a vendor for a distribution of the Java platform.
这是一个流程图,可帮助您为 Java 平台的分发选择供应商。