Old Java can learn new tricks from C, Android

Experts say the language should crib app isolation, locality, and automated parallelism from more modern sources

Java and its linchpin JVM (Java Virtual Machine) still have much room to get better even after debuting 18 years ago, say experts who would like improvements in such areas as locality, application isolation, and parallel operations.

The JVM, which has provided a mechanism to run Java applications on multiple hardware platforms, could be fitted with capabilities similar to the C language's struct feature, providing benefits in locality by improving linkage between memory and processors. "[Struct] gives advantages in the area of footprint," and provides a lightweight object with fields and no methods, says Charlie Hunt, architect of performance engineering at Salesforce.com and author of the book, "Java Performance."

[ Java 7's bytecode checker has been called a step backward for the JVM. | Stay informed of the latest Java news by subscribing to InfoWorld's Enterprise Java newsletter. ]

Doug Lea, who serves on the governing board of the OpenJDK open source Java implementation and formerly served with the Java Community Process, expects struct capabilities to be added to the JVM at some point. Struct would provide both a smaller footprint and better locality, and it's already embraced by some JVM languages, such as Scala, he says.

Java and mobile applications in particular, meanwhile, could benefit from Google Android's "failsafe" capabilities enabling application isolation, Lea says. In Android's Dalvik VM, isolation capabilities prevent a misbehaving process from impacting another process, Lea explains, noting that "the impact is contained." But he is not optimistic this capability will make it over to the JVM, citing policy and Java politics. "Even though it was a Sun Labs project," he says, "it was not adopted by [the HotSpot JVM], but something similar was adopted by Android folks."

Automated parallel operations for the Java language and runtime are desirable, Hunt says. Lambda capabilities in Java Standard Edition 8 bring this closer to happening via an API, but Hunt would like to see parallelism go a step further. "Ideally, what you'd like to be able to have is a language and a runtime that you don't have to express it explicitly. It just figures this out automatically."

Lea also anticipates virtual machine improvements in terms of dealing with contention-prone memory, thus boosting application performance. He notes multicore processors are dealing with the issue of "false sharing," with processors fighting over memory. It is not specifically a problem with Java. "It's an issue that arises everywhere. It has mainly heuristic solutions, and we need more of them."

This article, "Old Java can learn new tricks from C, Android," was originally published at InfoWorld.com. Follow the latest developments in business technology news and get a digest of the key stories each day in the InfoWorld Daily newsletter. For the latest developments in business technology news, follow InfoWorld.com on Twitter.

Read more about application development in InfoWorld's Application Development Channel.

This story, "Old Java can learn new tricks from C, Android" was originally published by InfoWorld.

Copyright © 2013 IDG Communications, Inc.

7 inconvenient truths about the hybrid work trend
Shop Tech Products at Amazon