is already available. Schlumberger has already built a Java smartcard using Motorola's 6805 8-bit processor.
However, making Java smaller doesn't meet the requirements of real-time systems, particularly hard real-time systems. According to Curtis Sasaki, JavaSoft's product line manager for JavaOS and JavaPC, JavaSoft is investigating not only the construction of a deterministic garbage collector for the Java Virtual Machine (JVM) -- which is needed for hard real-time performance -- but is also designing the JVM so that you can plug in your favorite garbage collector. This would let you tailor your JVM to the specific memory needs of your application.
NewMonics (Ames, IA; 515-296-0897) is unwilling to wait for JavaSoft. Its Portable Environment for Real-time Control is an effort to anoint Java with the ingredients necessary to make it a viable real-time environment. This involves additions to the l
anguage syntax, adding real-time class libraries, a special compiler, and a modified JVM.
PERC extends the Java syntax with two new statement types:
timed
and
atomic
. Code in a
timed
statement must execute in a specified amount of time. For example, the following listing shows a
timed
segment of code in which
method1()
must execute within 100 microseconds:
timed(Time.us(100)) {
method1();
}
The syntax for the
atomic
statement is similar (though there is no attached argument, as with
timed
). Code that's governed by an
atomic
statement must execute to completion, or it won't execute at all.
Even with these alterations, the PERC system has not abandoned portability. The
timed
and
atomic
statements, when compiled by the PERC compiler, appear in the final bytecodes as special
attributes
. A standard JVM ignores these attributes, so PERC-compiled code won't break a JVM. PERC
provides a modified JVM (called a PVM), which includes support for real-time operations.
Furthermore, NewMonics has written the
p2jpp
front-end compiler, which can compile PERC code into standard Java code. The features of
atomic
and
timed
statements are handled by special classes and objects supplied by NewMonics. Consequently, you can compile PERC-specific code to run on a standard JVM, although you'll lose some of the PVM's benefits, such as deterministic scheduling and garbage collecting.
Get Active
In the PERC view of things, a real-time program is a set of activities. Each activity shepherds a given aspect of the system. Therefore, one activity might manage a front-panel display, while another activity would communicate with the hardware that's controlled by that display.
PERC captures this abstract notion of an activity into a class. Activity objects, in one sense, are containers, because they gather the tasks that manage the object's associated r
eal-world behavior.
In another sense, each activity object is a kind of environment. The details of that environment are dictated by the properties of the activity. Some activities require more resources, others less. As part of its initialization, an activity object must enter into a resource negotiation with the run-time system. In other words, the activity object communicates with the real-time manager in the PVM, informing the kernel of the CPU time and memory requirements that the activity's tasks will need.
The PVM returns a two-part response that tells the petitioning activity the resource quantities that the PVM can guarantee, as well as those quantities that it can expect to provide. The calling activity must then determine whether to accept or reject the response. This negotiation takes place at run time, letting a real-time application adjust itself to whatever platform it finds itself on.
At this point, it's unclear whether PERC will succeed out from underneath the JavaSoft umbre
lla. Because PERC extends the syntax of Java and modifies the JVM, NewMonics is unable to officially attach the Java name to PERC. So far, Integrated Systems has signed a license to include the PERC system in its well-known real-time OS (RTOS), pSOS. Kelvin Nilsen, founder of NewMonics, says that he is pursuing other RTOS vendors. I hope he succeeds.