OpenJDK 与 Java HotspotVM

2022-01-16 00:00:00 jvm java jvm-hotspot openjdk hotspot

OpenJDK VM 和 Oracle Hotspot VM 仍然是两个不同的 JVM 吗?

Are OpenJDK VM and Oracle Hotspot VM still two different JVMs?

我似乎找不到任何关于 OpenJDK VM 的官方文档.甚至在 OpenJDK 主页上也有一个开发 HotSpot VM 的 HotSpot Group.

I can't seem to find any somewhat official documentation on anything about OpenJDK VM. Even in OpenJDK homepage there is an HotSpot Group which develops HotSpot VM.

HotSpot 小组由参与 HotSpot 虚拟机的设计、实施和维护的开发人员组成

The HotSpot group is comprised of developers involved in the design, implementation, and maintanence of the HotSpot virtual machine

但是,如果我在我的 Windows 机器上检查 java -version 它会打印出来

However if I check java -version on my Windows machine it prints out

Java HotSpot(TM) 64 位服务器虚拟机

Java HotSpot(TM) 64-Bit Server VM

但是在我的 Ubuntu VPS 上

But on my Ubuntu VPS

OpenJDK 64 位服务器虚拟机

OpenJDK 64-Bit Server VM

如果这是两个不同的虚拟机,它们之间的主要区别是什么?它们有不同的运行时标志集吗?

If those are two different VMs what are the main differences between them? Do they have different runtime flag sets?

推荐答案

Oracle HotSpot JVM 基于 OpenJDK HotSpot 项目.因此,它们大多是相同的 VM,除了 Oracle JVM 有一些额外的商业特性,主要是 Java 飞行记录器,应用类数据共享和协同内存管理.

Oracle HotSpot JVM is based on OpenJDK HotSpot project. So, they are mostly the same VM, except that Oracle JVM has a few additional commercial features, mainly, Java Flight Recorder, Application Class Data Sharing and Cooperative Memory Management.

两个虚拟机的运行时标志几乎相同;使用查看完整列表

Runtime flags are almost the same for both VMs; see the complete list using

-XX:+UnlockDiagnosticVMOptions -XX:+UnlockCommercialFeatures -XX:+PrintFlagsFinal

从 JDK 8u131 开始,唯一的区别在于以下标志(OpenJDK VM 中不存在):

As of JDK 8u131, the only difference is in the following flags (absent in OpenJDK VM):

 bool EnableResourceManagementTLABCache         = true         {product}
 bool EnableSharedLookupCache                   = true         {product}
 bool FlightRecorder                            = false        {commercial}
ccstr FlightRecorderOptions                     =              {product}
 bool LogCommercialFeatures                     = false        {product}
ccstr MemoryRestriction                         = none         {commercial}
 bool ResourceManagement                        = false        {commercial}
 intx ResourceManagementSampleInterval          = -1           {commercial}
ccstr StartFlightRecording                      =              {commercial}
 bool TraceSharedLookupCache                    = false        {product}
 bool UnlockCommercialFeatures                 := true         {commercial}
 bool UseAppCDS                                 = false        {commercial}

相关文章