JAVA-BASED REAL-TIME PROGRAMMING
JAVA-BASED REAL-TIME PROGRAMMING
JAVA-BASED REAL-TIME PROGRAMMING
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
3. Multi-Threaded Programming<br />
1. The correctness of our software, except for timing which is what priorities<br />
are for, should never depend on priorities. For instance, it should<br />
be considered as an error to accomplish mutual exclusion by utilizing<br />
the knowledge that one thread will have a higher priority than another.<br />
Even if that always is the case, there is no guarantee that priorities are<br />
strictly obeyed on all platforms. That is, using an RTOS a higher priority<br />
thread always given precedence in favor of a low priority thread, but<br />
on Solaris, Linux, Windows, and other desk-top and server platforms,<br />
you cannot know. Those types of systems are optimized for overall performance<br />
and can in principle not be trusted for hard real-time systems.<br />
So, if embedded software requires a certain RTOS anyway, additional<br />
requirements on the number of priorities etc. go along the the system<br />
requirements. Still, the logical and concurrent behavior of the system<br />
should remain on any Java-enabled platform.<br />
2. An application that depends on scheduling principles and the number<br />
of priority levels can obtain the type of OS and other properties at<br />
run time (e.g., by calling System.getProperty(“os.name”);), and behave<br />
accordingly. A OS-dependent but portable application simply has to<br />
cope with reality (rather than Java principles).<br />
3. Priorities are managed globally for the software application and they<br />
influence the global properties of the system. However, a certain thread<br />
created in a class library or in a third-party component too often gets a<br />
(usually hard-coded) priority that does not suit the rest of the system.<br />
Furthermore, the desired system properties are not necessarily easy to<br />
express using priorities. Response time, control performance, quality<br />
of service, etc. are more related to end-user values. Obtaining priorities<br />
from such properties is outside the scope of this chapter. Another<br />
approach would be to have a real-time platform with built-in timing<br />
and/or performance optimization, perhaps not using priorities at all.<br />
The classical approach, found in almost any OS is to use priorities, and<br />
that is also what Java provides. The ability to run the software on any<br />
Java platform is a must. Therefore, additional supporting classes are<br />
needed for implementation of real-time systems, but for now we stay<br />
with multi-threaded programming and the standard and portable Java<br />
features.<br />
The conclusion is that priorities, as defined in Java, are useful for simple<br />
tuning of application performance and responsiveness, but for large-scale realtime<br />
systems we need additional supporting classes but that is a later issue.<br />
50 2012-08-29 16:05