Archives
 
 
 
  Special
 
 
 
  About Us
 
 
 

Newsletter
Free E-mail Newsletter from BYTE.com

 
    
           
Visit the home page Browse the four-year online archive Download platform-neutral CPU/FPU benchmarks Find information for advertisers, authors, vendors, subscribers Request free information on products written about or advertised in BYTE Submit a press release, or scan recent announcements Talk with BYTE's staff and readers about products and technologies

ArticlesJava in the Real World


July 1997 / Javatalk / Visual Age for Java / Java in the Real World

Java's original target was not desktop browsers; it was conceived as a language for "smart," embeddable appliances. Java, as we know it in our Web browsers, requires several megabytes to live comfortably. JavaSoft, in an ongoing effort to make Java portable not only across system types, but across system sizes as well, is in the process of releasing APIs that specify Java environments that are more appropriate for embedded devices.

The specifications for EmbeddedJava and PersonalJava may be available by the time you read this (JavaSoft plans the final release in the third quarter). The Java Card API -- targeted for super low-resource smartcards -- 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.


Up to the Javatalk section contentsGo to previous article: Java in the Real WorldSearchSend a comment on this articleSubscribe to BYTE or BYTE on CD-ROM  
Flexible C++
Matthew Wilson
My approach to software engineering is far more pragmatic than it is theoretical--and no language better exemplifies this than C++.

more...

BYTE Digest

BYTE Digest editors every month analyze and evaluate the best articles from Information Week, EE Times, Dr. Dobb's Journal, Network Computing, Sys Admin, and dozens of other CMP publications—bringing you critical news and information about wireless communication, computer security, software development, embedded systems, and more!

Find out more

BYTE.com Store

BYTE CD-ROM
NOW, on one CD-ROM, you can instantly access more than 8 years of BYTE.
 
The Best of BYTE Volume 1: Programming Languages
The Best of BYTE
Volume 1: Programming Languages
In this issue of Best of BYTE, we bring together some of the leading programming language designers and implementors...

Copyright © 2005 CMP Media LLC, Privacy Policy, Your California Privacy rights, Terms of Service
Site comments: webmaster@byte.com
SDMG Web Sites: BYTE.com, C/C++ Users Journal, Dr. Dobb's Journal, MSDN Magazine, New Architect, SD Expo, SD Magazine, Sys Admin, The Perl Journal, UnixReview.com, Windows Developer Network