A real-time application may consist of a host computer that communicates with several microprocessors, each of which senses some physical property (like the temperature in a room, or the speed at which a wheel is spinning) or controls some device. The host and an individual microprocessor communicate through a ``register'': a location in the microprocessor's memory. This location is ``mapped'' onto a fixed location in the host processor's memory, so that when the host references that memory location, it is really referencing the microprocessor's register. This is why many real-time applications need to read and write specific memory locations.
The microprocessor usually has a ``program status word'', or psw, whose bits are used to indicate the status of the microprocessor. For example, one of the bits, say C, might be used as follows: When the host computer is ready to read a value from the microprocessor's register, it (0) sets bit C to 1, (1) waits until C is set to 0 (by the microprocessor, to indicate that a new value is in its register), and then reads the register. This is how the host computer and the microprocessor communicate and synchronize.
Because of its built-in security measures, Java lacks the ability to manipulate the contents of specific memory addresses explicitly, so it is not well suited to real-time programming. However, Java does provide the tools needed to simulate a real-time computing environment. We have developed a real-time simulation program, which simulates a cruise control system, to introduce you to real-time computing. In it, we simulate this aspect of communication using a method readValue().