18
K
A
DAK
General AMX Operation
The AMX 86 Task Mailbox facility provides a general purpose message queuing
mechanism for tasks. This service is not provided by a separate AMX manager; it is an
inherent feature of AMX 86. Any task can have up to four private mailboxes in which
the task can receive AMX messages. Tasks, ISPs or Timer Procedures can send
messages to such a task mailbox. The messages are ordered in each task mailbox
according to their order of arrival. If such a task is idle when a message is deposited in
one of its mailboxes, the task will automatically be started and given the message
extracted from the mailbox. At any time, a task can request a message from any of its
mailboxes. When the task ends, it will automatically be restarted if its mailboxes are not
all empty. The task will be given the highest priority message available.
The Message Ex change Manager provides a general purpose prioritized message
queuing facility. Tasks, ISPs or Timer Procedures can send messages to a message
exchange to be queued at any of four priority levels. When a task requests a message
from a message exchange, it is given the highest priority message available. If no
message is available, the task will be forced to wait. The task will be placed on the
message exchange wait queue at the wait priority specified by the task. Optionally, the
task can specify a timeout interval limiting the time the task is prepared to wait. This
interval can be from no wait to an indefinite wait. When a message subsequently arrives,
it is immediately given to the task waiting at the top of the message exchange's wait
queue.
The Buffer Manager provides fast, efficient access to multiple pools of buffers, each
buffer representing a fixed size block of memory. This form of memory management
meets the requirements of most typical applications and is best suited for real-time use in
which memory block availability must be predictable and in which the penalties for
memory fragmentation cannot be tolerated.
Application modules can request the Buffer Manager to get a buffer from a pool. Unlike
other AMX managers, the Buffer Manager does not permit a task to wait for a buffer to
become available.
When released, the buffer is automatically returned by the Buffer Manager to the pool to
which the buffer belongs. Buffer ownership can be increased so that more than one task
can simultaneously own a shared buffer. Special facilities are provided to assure that if a
buffer is owned by more than one task, it is only returned to its pool when the slowest
owner finally releases it.
The Memory Manager controls the dynamic allocation of memory to tasks in the
multitasking environment. Multiple sections of user defined memory can be controlled
by the Memory Manager. A section can exceed 64K bytes. The memory in each section
must be contiguous but the sections themselves do not have to be contiguous.
A task can request the Memory Manager to allocate a contiguous block of memory of any
size. When finished with the block, the task requests the Memory Manager to free the
memory for use by other tasks.
A particularly unique feature of the Memory Manager permits any block of memory
(including those acquired from the Memory Manager) to be treated as memory from
which smaller private blocks can be dynamically allocated.