General AMX Operation
K
A
DAK
13
The Task Scheduler
Following system initialization, AMX proceeds to its Task Scheduler. The Task
Scheduler searches its list of available tasks to determine the highest priority task capable
of execution. Task execution priorities are determined by the system designer. If no task
is ready to begin execution, AMX sits with interrupts enabled, waiting for some external
event to generate an interrupt.
AMX begins task execution at the task's defined start address. The task executes as
though it were the only program in the system. Services offered by AMX can be invoked
by the task by procedure calls as indicated in Figure 2.2-1.
Once a task begins execution, it appears to operate without interruption. The interrupts
that are periodically taking place are completely hidden from the task by the AMX
Interrupt Supervisor and Task Scheduler. The task, once executing, inhibits the
performance of all tasks of priority lower than its own. The task continues to execute
until it decides to relinquish control, even if only temporarily, by calls to AMX.
The task ends by returning to the AMX Task Scheduler which again finds the next
highest priority task ready to execute and gives it control of the processor. A task, once
executing, is free to call any of the AMX task services. For instance, a task can send a
message to a task mailbox or message exchange, wait for an event or wait for a timed
interval. If the task wishes to wait for an event, the AMX service procedure will suspend
the task and request the AMX Task Scheduler to force execution of the next highest
priority task ready for execution.
AMX acts as the context switcher supervising the orderly execution of application tasks.
AMX employs a preemptive, priority-driven scheduling algorithm which ensures that the
highest priority task which is ready to do useful work always has control of the processor.
AMX will switch tasks if it receives a request from the executing task 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.