InfoQ

InfoQ

News

My Bookmarks

Login or Register to enable bookmarks for unlimited time.

The content has been bookmarked!

There was an error bookmarking this content! Please retry.

Comparing Virtual Machine Interfaces

Posted by R.J. Lorimer on Aug 10, 2008

Sections
Operations & Infrastructure,
Enterprise Architecture,
Development,
Architecture & Design
Topics
Java ,
Open Source ,
Platforms
Tags
GNU ,
Open source Java ,
Open JDK
Andrew John Hughes has been comparing OpenJDK to GNU Classpath in his recent blog entries. Hughes has been working on building a virtual machine interface for OpenJDK that will allow it to be quickly ported to various VM implementations. This work has been part of the OpenJDK Innovators' Challenge, in which Hughes is one of the eight finalists; the final proposal from Hughes was posted earlier this year. The other proposals include:
While developing the solution for virtual machine interfaces, Andrew has been documenting the different different approaches taken between OpenJDK and GNU Classpath.

GNU classpath has been designed for several years for VM portability, with several examples of GNU classpath-enabled VMs (JamVM, CACAO, and Kaffe among others). OpenJDK, on the other hand, was built around one JVM, Hotspot, over the course of the past several years. As indicated by Hughes, the boundaries of the virtual machine and the class libraries exist, but the line may be a little less clear simply due to this evolution:
Both solutions do provide separation between the library and the VM. Contrary to what may be initially assumed, this is true of OpenJDK even though both HotSpot and the JDK are maintained in the same location. This is what allows different versions of HotSpot to be swapped in, as mentioned in the OpenJDK trademark license. That said, there are likely to be closer ties between the JDK within OpenJDK and HotSpot than there are between GNU Classpath and any of its VMs, simply because of the number of and variance between the latter.
Here are some of the differences that Andrew has found:
  • Preloaded Native Library - libjava.so is a custom Java library that must be pre-loaded for OpenJDK, as opposed to being loaded by the class libraries as needed. Hughes explains how CACAO (an open-source JVM that already supports OpenJDK) handles this:
In CACAO, a special OpenJDK case is provided in src/native/vm/nativevm.c to handle this. This needs to happen early in the VM initialisation process before any of the native calls in the core classes are used.
  • VM delegate classes - Many of the core libraries in OpenJDK delegate directly to a native interface (Andrew uses Object.wait, a natively declared method as an example). In contrast, GNU Classpath introduces an intermediate VM* class in most cases, which for Object.java is VMObject.java - this class performs all native delegation, and replaceable by the underlying JVM implementation.
  • Class Library Invocations from VM Code - There are certain cases in both VMs where calls must be made into the class library from the VM. Because of that, the internal structure of the class-library has a very direct influence on the VM implementation. Cases mentioned by Hughes where there are differences include booting the JVM, creating NIO byte buffers, and dealing with threads and thread groups.
While the source for the Sun JDK has been available under various licenses for quite some time, GNU Classpath, for legal reasons, has evolved without any exposure; none of the Sun JDK licenses have been open-source compliant. Since the Sun JVM and JDK has been re-licensed as GPL, however, developers are starting to compare and contrast the two platforms.

The results of the OpenJDK Innovators' Challenge are to be announced on August 18th, 2008.

No comments

Watch Thread Reply

Educational Content

New-age Transactional Systems - Not Your Grandpa's OLTP

John Hugg discusses high volume transaction processing applications with high and low frequency profiles, and how VoltDB can be used for that purpose.

Cool Code

Kevlin Henney examines code samples to see what can be learned from them starting from the premise that one won’t write great code unless he knows how to read it.

Collaboration: At the Extremities of Extreme

Jason Ayers share the observations he made watching a team of developers collaborating in real time on the same code base, pushing XP, pair programming and continuous integration to their extremes.

Yesod Web Framework

Michael Snoyman presents Yesod, a web framework written in Haskell and containing a web server, templating, ORM, libraries (templating, gravatar, etc.).

Transactions without Transactions

Richard Kreuter and Kyle Banker on how to avoid classical RDBMS transactional systems by using compensation mechanisms, transactional messaging or transactional procedures.

Attila Szegedi on JVM and GC Performance Tuning at Twitter

Attila Szegedi talks about performance tuning Java and Scala programs at Twitter: how to approach GC problems, the importance of asynchronous I/O, when to use MySQL/Cassandra/Redis, and much more.

10 tips on how to prevent business value risk

One category of risk that project teams need to ensure they address is business value failure – delivering a product that fails to provide value for the business investor.

Interview: Software Systems Architecture: Working With Stakeholders Using Viewpoints and Perspectives

InfoQ spoke to the authors of Software Systems Architecture on a couple of new topics, the System Context viewpoint and Agile, which have been added to the second edition.