Little-known real-time standard affects broad span of Java applications

toned close up of a hand holding a stopwatch 57437132

The recent progress of the 2.0 Real-Time Specification for Java (RTSJ) has consequences far beyond the traditional real-time programming world.

This impact belies the reputation RTSJ has among many Java users. "Real-time Java" was at one time an oxymoron for projects that relied on early, unoptimized implementations. Even those aware that RTSJ 1.0 was important enough to be the very first standard to emerge in 2002 from the Java Community Process (JCP) as JSR-1 believed that nothing significant had happened since. To the casual observer it seems that RTSJ has been dormant for much of the last decade.

Context for 2.0

Behind the scenes considerable effort and advance have yielded a RTSJ 2.0 draft, whose public review started at the beginning of 2015. Academic and industrial research yielded effective real-time garbage collection along with other practical necessities for RTSJ. Beefier hardware and expectations in embedded programming have shifted the emphasis there from assembly language and C to the richer development environment that Java offers.

The success of the related Safety-Critical Java codified by JCP as JSR-302 has begun to make Java an alternative to Ada in applications for demanding aerospace, medical, and similar projects. Meanwhile Oracle, owner of the Java trademark, has taken to explicitly promoting Java for embedded, safety-critical, and real-time development. Mobile computing over the last decade, especially with Android, has provided valuable experience about what works and doesn't in that domain. The explosion of the Internet of Things (IoT) has raised the premium for a productive, scalable, embeddable, trustworthy language. Finally, the Java language itself has evolved significantly since RTSJ 1.0, and 2.0 deserves freshening on that basis alone.

RTSJ 2.0 features apply throughout Java programming

All of these trends have set the stage for RTSJ 2.0. Specification Lead James Hunt spoke with pride about the release in a recent conversation. He underlined that while 2.0 certainly improves on 1.0 from a strictly real-time perspective, it has applications well beyond those confines.

RTSJ 2.0 is a foundry for functionality that many Java programmers are beginning to need. Thoughtful leveraging of Java's recent emphasis on modularization means that 2.0 defines an entire "dynamic cyberphysical platform" whose features can migrate out to the wider Java development world, said Hunt. These include:

  • Type-safe device access. Rather than PEEKs and POKEs and reliance on Java Native Interface wrangling, RTSJ pioneers higher-level programming capabilities that will be welcome to those working on BeagleBoards, Arduinos, or any other hardware connected to the real world.
  • User-defined clocks as a more programmable alternative for certain uses of interrupt service routines (ISRs).
  • A comprehensive event model that, among other qualities, has long been argued as a safer alternative to threads for concurrent programming.
  • Affinity definitions that manage binding of computations to specific cores or sets of cores.

More to come

Even if the work on RTSJ 2.0 goes entirely according to plan in 2015, Hunt sees plenty of work ahead for RTSJ. Generalization of scheduler support from fair-scheduled and priority-preemptive first-in-first-out (FIFO) schemes to include round robin (RR) and earliest deadline first (EDF) models is an area that deserves more research. "We will work toward integrating some of the RTSJ features into the OpenJDK, particularly the event-handling mode. This will help make it easier to move code between the environments and give the larger Java community an additional programming model."

Whatever your focus within Java, you likely have a stake in such trends as mobile computing, massive scaling, time-dependent results, and IoT. Now might be the time to get started with an RTSJ 2.0 reference implementation like Jamaica VM, which is available at no charge for personal use. You can use use it to explore techniques like those listed above and more, which are likely to spread through and dominate the future of these and other emerging application arenas.

This story, "Little-known real-time standard affects broad span of Java applications" was originally published by JavaWorld.

Copyright © 2015 IDG Communications, Inc.

Bing’s AI chatbot came to work for me. I had to fire it.
Shop Tech Products at Amazon