Microprocessors are small computers, usually embedded in other systems. Microprocessors are used to monitor and regulate the behavior of many common commercial products. For example, dedicated microprocessor systems are used in cars to regulate the fuel-air mixture for combustion and prevent skidding (using anti-lock brake systems). Around the home, they appear in appliances such as cellular phones, microwave ovens and thermostats for heating and cooling systems. They are used in modems, laser printers, graphics boards, and disk drives. More exotic applications include medical instrumentation, detection of collision and decay events in high energy particle accelerators, and regulation of nuclear reactors.
Microprocessors appear in settings where real-time computing is necessary: responses to external signals or changes --which can come at unpredictable times-- must take place within a specific amount of time. Some microprocessors must also be able to generate electrical signals that can be used to control other devices.
The anti-lock brake system on a car is a good example of the challenging nature of real-time computing applications. Here, the microprocessor must detect changes in the rotational rates of the wheels characteristic of a skid. For example, a rapidly rotating wheel might abruptly stop rotating. If the angular velocity of the wheels increases too fast, the tire is slipping on the pavement and the car may be skidding; controlling the situation may be difficult for the driver. Detecting and correcting this situation involves monitoring the rate of change of the angular velocity (i.e. the angular acceleration), not just the angular velocity itself. Upon detecting this situation, the microprocessor must generate a sequence of output pulses that are used to control the hydraulic brake system, allowing the wheels to intermittently rotate to prevent a skid, thus making the car easier to control. Clearly, quick response1 to inputs from external transducers is essential in this application. Not only must the response be quick, it must be appropriate for all imaginable driving conditions. For example, it would unacceptable for the microprocessor to interfere with normal braking operations at slow speeds.
Most real-time programming is done in assembly language or a programming language like C (or C++) that allows the programmer to explicitly manipulate the contents of specific memory locations. This is because communication with a microprocessor is often done through fixed memory locations. The real-time microprocessor itself is often programmed in its native assembly language. The machine instructions are placed in the microprocessors memory, which is physically distinct from the memory system of the host computer, so that the instructions can be executed autonomously by the real-time processor system.