- Scheduling
- Memory Management
- Synchronization
- Asynchronous Event Handling
- Asynchronous Transfer of Control
- Asynchronous Thread Termination
- Physical Memory Access
- Exceptions
- Minimum Implementations of the RTSJ
- Optionally Required Components
- Documentation Requirements
- Parameter Objects
- Java Platform Dependencies
Physical Memory Access
The RTSJ defines classes for programmers wishing to directly access physical memory from code. RawMemoryAccess defines methods that allow the programmer to construct an object that represents a range of physical addresses and then access the physical memory with byte, short, int, long, float, and double granularity. No semantics other than the set<type>() and get<type>() methods are implied. The ScopedPhysicalMemory and ImmortalPhysicalMemory classes allow programmers to create objects that represent a range of physical memory addresses and in which Java objects can be located. The RTSJ requires a PhysicalMemoryFactory in each implementation. Methods on the factory object are the only way to create instances of physical memory objects. On each physical memory class create() methods invoke appropriate methods on the PhysicalMemoryFactory class to create the required instance. The factory also enforces security policies.
Raw Memory Access
An instance of RawMemoryAccess models a "raw storage" area as a fixed-size sequence of bytes. Factory methods allow RawMemoryAccess objects to be created from memory at a particular address range or using a particular type of memory. The implementation must provide a factory that interprets these requests correctly. The factory may be set by applications based on documentation from the implementation provider. A full complement of set<type>() and get<type>() methods allow the contents of the physical memory area to be accessed through offsets from the base, interpreted as byte, short, int, long or float data values, and copied to/from arrays of those types.
The byte-ordering interpretation of the data is based on the value of the BYTE_ORDER static variable in class RealtimeSystem.
The RawMemoryAccess class allows a real-time program to implement device drivers, memory-mapped I/O, flash memory, battery-backed RAM, and similar low-level software.
A raw memory access object cannot contain objects or references to objects. Such a capability would be unsafe (since it could be used to defeat Java's type checking) and error-prone (since it is sensitive to the specific representational choices made by the Java compiler). This capability is provided by physical memory areas, which do not provide raw access to the memory.
Physical Memory Areas
In many cases systems, needing the predictable execution of the RTSJ will also need to access various kinds of memory at particular addresses for performance or other reasons. Consider a system in which very fast static RAM was programmatically available. A design that could optimize performance might wish to place various frequently used Java objects in the fast static RAM. The ScopedPhysicalMemory and ImmortalPhysicalMemory classes allow the programmer this flexibility. The programmer would construct a physical memory object on the memory addresses occupied by the fast RAM.
In order to maintain safety, a factory object constructs all physical memory objects. The factory ensures that physical memory areas don't overlap other memory areas or raw memory access objects.