RTEMS Logo

RTEMS 4.9.2 On-Line Library


Task Manager TASK_CREATE - Create a task

PREV UP NEXT Bookshelf RTEMS Ada User's Guide

5.4.1: TASK_CREATE - Create a task

CALLING SEQUENCE:

procedure Task_Create (
   Name             : in     RTEMS.Name;
   Initial_Priority : in     RTEMS.Task_Priority;
   Stack_Size       : in     RTEMS.Unsigned32;
   Initial_Modes    : in     RTEMS.Mode;
   Attribute_Set    : in     RTEMS.Attribute;
   ID               :    out RTEMS.ID;
   Result           :    out RTEMS.Status_Codes
);

DIRECTIVE STATUS CODES:

RTEMS.SUCCESSFUL - task created successfully
RTEMS.INVALID_ADDRESS - id is NULL
RTEMS.INVALID_NAME - invalid task name
RTEMS.INVALID_PRIORITY - invalid task priority
RTEMS.MP_NOT_CONFIGURED - multiprocessing not configured
RTEMS.TOO_MANY - too many tasks created
RTEMS.UNSATISFIED - not enough memory for stack/FP context
RTEMS.TOO_MANY - too many global objects

DESCRIPTION:

This directive creates a task which resides on the local node. It allocates and initializes a TCB, a stack, and an optional floating point context area. The mode parameter contains values which sets the task's initial execution mode. The RTEMS.FLOATING_POINT attribute should be specified if the created task is to use a numeric coprocessor. For performance reasons, it is recommended that tasks not using the numeric coprocessor should specify the RTEMS.NO_FLOATING_POINT attribute. If the RTEMS.GLOBAL attribute is specified, the task can be accessed from remote nodes. The task id, returned in id, is used in other task related directives to access the task. When created, a task is placed in the dormant state and can only be made ready to execute using the directive rtems.task_start.

NOTES:

This directive will not cause the calling task to be preempted.

Valid task priorities range from a high of 1 to a low of 255.

If the requested stack size is less than the configured minimum stack size, then RTEMS will use the configured minimum as the stack size for this task. In addition to being able to specify the task stack size as a integer, there are two constants which may be specified:

Application developers should consider the stack usage of the device drivers when calculating the stack size required for tasks which utilize the driver.

The following task attribute constants are defined by RTEMS:

The following task mode constants are defined by RTEMS:

The interrupt level portion of the task execution mode supports a maximum of 256 interrupt levels. These levels are mapped onto the interrupt levels actually supported by the target processor in a processor dependent fashion.

Tasks should not be made global unless remote tasks must interact with them. This avoids the system overhead incurred by the creation of a global task. When a global task is created, the task's name and id must be transmitted to every node in the system for insertion in the local copy of the global object table.

The total number of global objects, including tasks, is limited by the maximum_global_objects field in the Configuration Table.


PREV UP NEXT Bookshelf RTEMS Ada User's Guide

Copyright © 1988-2008 OAR Corporation