Application Tasks
K
A
DAK
25
3. Application Tasks3.1 Task Creation
The AMX Multitasking Executive provides a simple solution to the complexity of 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.
The maximum number of tasks in a system is user defined in your System Configuration
Module (see Chapter 14.5). The defined maximum sets an upper limit on the number of
actual tasks that can be created by the application. AMX 86 sets an upper bound of 100
tasks in a system. Other versions of AMX have no such restriction.
Tasks can be created in two ways. Tasks can be predefined in your AMX System
Configuration Module which is processed by AMX at startup. Tasks defined in this
fashion are automatically created by AMX but are not started. Restart Procedures and
tasks can also dynamically create tasks using AMX procedure ajtkcre.
AMX assigns a task identifier (id) to each task when it is created. The task id is a handle
which uniquely identifies the particular task. When AMX prebuilds a task, it saves the
task identifier in the id variable specified in the task's description.
When tasks are created dynamically, AMX returns the assigned task id to the creator. It
is the responsibility of the application to keep track of the task id for future reference to
the task.
When a task is created, you can provide a unique 4-character task tag to identify the task.
The tag can be used subsequently in a call to ajtktag to find the task id allocated by
AMX to the particular task.
AMX uses the information in the task definition to construct a Task Control Block (TCB)
for the task. The TCB of each task is used exclusively by AMX to control task
execution. At any instant in time, the content of the TCB, as maintained by AMX,
completely describes the state of the corresponding task.