This section describes the two real-time thread classes. These classes:
RealtimeThread class extends
ReleaseParameters, SchedulingParameters, and
objects passed to the
RealtimeThread constructor allow the temporal
and processor demands of the thread to be communicated to the scheduler.
NoHeapRealtimeThread class extends
NoHeapRealtimeThread is not
allowed to allocate or even reference objects from the Java heap, and can thus
safely execute in preference to the garbage collector.
The RTSJ provides two types of objects which implement the Schedulable interface: real-time threads and asynchronous event handlers. This chapter defines the facilities that are available to real-time threads. In many cases these facilities are also available to asynchronous event handlers. In particular:
AsynchronouslyInterruptedExceptionis pending. This attribute is set when a call to RealtimeThread.interrupt() is made on the associated real-time thread, and when an asynchronously interrupted exception's
firemethod is invoked between the time the real-time thread has entered that exception's
doInterruptiblemethod, and return from
doInterruptible. (See the Asynchrony chapter.)
waitForNextPeriodInterruptiblemethods are for use by real-time threads that have periodic release parameters. In the absence of any deadline miss or cost overrun (or an interrupt in the case of
waitForNextPeriodInterruptible) the methods return when the real-time thread's next period is due.
RealtimeThreadthat are created in scoped memory and instances of
NoHeapRealtimeThreaddo not have conventional references to thread groups nor do thread groups have conventional references to these threads. For the purposes of this version of the specification those references are
ThreadDeaththe thread simply terminates
System.errbefore it terminates.
The Java platform's priority-preemptive dispatching model is very similar to
the dispatching model found in the majority of commercial real-time operating
systems. However, the dispatching semantics were purposefully relaxed
in order to allow execution on a wide variety of operating systems. Thus,
it is appropriate to specify real-time threads by extending
RealtimeThread constructor allow for a number of common
real-time thread types, including periodic threads.
NoHeapRealtimeThread class is provided in order to allow
time-critical threads to execute in preference to the garbage collector given
appropriate assignment of execution eligibility. The memory access and
assignment semantics of the
NoHeapRealtimeThread are designed to
guarantee that the execution of such threads does not lead to an inconsistent