Real-time Java

This is an old revision of this page, as edited by 84.61.26.158 (talk) at 19:57, 10 January 2006 (Real Time System?). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Java supported threaded programming from the very beginning.

Real Time System?

It was not immediately suitable for Real time systems for two reasons:

  • The threading behavior was largely unspecified. This, reputedly, was a concession to Microsoft to allow for the weak threading models underlying the Microsoft Windows operating system at the time.
  • Still, there is only one synchronization primitive available for locking, the monitor pattern, meaning that only code sections can be guarded, not data.
  • More critically, the garbage collector behavior introduces unbounded delays in computation, immediately destroying any chance of making real-time guarantees for programs written in Java.

The Java Programming Language

Because Java is such an elegant language for programming, and because it supports threading generally and several language features that promote correcntness, it is a good prospect for real-time systems. To produce a specification for Java that would allow its use in such environments, JSR001 was created. As of 2005, a number of implementations of the resulting Real-Time Specification for Java (RTSJ) have emerged, including a reference implementation Timesys,and a full fledged product from Sun Microsystems.

The RTSJ addresses the critical issues by mandating a minimum specification for the threading model (and allowing other models to be plugged into the VM) and by providing for areas of memory that are not subject to garbage collection, along with threads that are not preemptable by the garbage collector.

In addition, many other enhancements to the Java system have been included resulting in a specification that provides realistic support for writing real-time systems in Java.