 |
Introduction
|
A real-time system is characterized by the need to respond rapidly
to events occurring asynchronously in time. A multitasking system is one
in which a number of activities or processes must be performed simultaneously
without interference with each other. A system in which several activities
must operate simultaneously, each with time-critical precision, is called
a real-time multitasking system. The AMX Multitasking Executive provides a
simple solution to the complexities introduced by real-time multitasking.
AMX supervises the orderly execution of a set of application program modules
called tasks. Each task solves a particular problem and provides a specific
functional capability within the system.
As we all know, the microprocessor can only do one thing at a time.
Fortunately, it does all things very quickly. However, to get the effect that
all activities are occurring simultaneously, it is necessary to rapidly switch
back and forth from one process to another in a well controlled fashion.
It is AMX, acting as a context switcher, which organizes and controls the
use of the microprocessor to achieve this apparent concurrent execution
of tasks. AMX employs a preemptive, priority-driven scheduling algorithm
which ensures that the highest priority task which is ready to do useful
work will always have control of the processor.
AMX is prompted to switch tasks by requests from three different sources:
tasks, interrupts and timers. The simplest, of course, is a request from the
executing task asking AMX to perform an operation which, of necessity, invokes
a task of higher priority. For instance, the executing task may request AMX
to start a higher priority task by sending a message to it. External events
can generate hardware interrupts to which the processor responds. An application
device dependent Interrupt Service Procedure is immediately executed to service
the event. This procedure can request AMX to perform an operation affecting
one or more of the tasks operating in the system. For instance, the service
procedure might request AMX to wake some task known to be waiting for the
particular event. If the task wakened is of higher priority than the task
which was executing at the time of the interrupt, AMX will automatically do
a task switch when the interrupt service is complete.
Most real-time systems require a hardware clock to provide precise interval
measurement. This clock provides the third mechanism which can force a task
switch to occur. When the hardware clock interrupt occurs, the application
clock service procedure informs AMX that a hardware clock tick has occurred.
The AMX Clock Handler triggers the AMX Kernel Task to provide timing services
if so required.
|