A process.
A task item contains all the information needed by the kernel to support multitasking. It contains room to store CPU registers when the associated task context goes to sleep, it contains pointers to various resources used by the task, and it specifies the task's priority. There is one task item for every task or thread that exists.
kernel
TASKNODE
CreateThread(), ExecuteAsThread(), LoadProgram(), CreateItem()
''%%FindTask%%''(), FindItem()
CREATETASK_TAG_MAXQ-a value indicating the maximum quanta for the task.
CREATETASK_TAG_PC-initial PC.
CREATETASK_TAG_STACKSIZE-the size of a task's call stack.
CREATETASK_TAG_ARGC-the initial argc value passed to the task when it starts up.
CREATETASK_TAG_ARGP-the initial argp value passed to the task when it starts up.
CREATETASK_TAG_SP-initial stack pointer value (thread only).
CREATETASK_TAG_BASE-the initial r9 value.
msg_Result
field of the message contains the exit status of the task. This is the value the task provided to exit()
, or the value returned by the task's primary function. The msg_DataPtr
field of the message contains the item number of the task that just terminated. Finally, the msg_DataSize
field contains the item number of the thread or task that terminated the task. If the task exited on its own, this will be the item number of the task itself. It is the responsibility of the task that receives the status message to delete it when it is no longer needed by using DeleteMsg().
exit()
, then the memory used for its stack must be freed automatically. When this tag is not provided, you are responsible for freeing the stack whenever the thread terminates.