Structuring Language: Activity Chart Implementation : TASK Activities

TASK Activities

In OSEK 2.0 OS – we identify two TASK types:

Various other properties might be related to a TASK, some depend on the TASK type and some common to both types, as described below.

Both types of TASKs might be scheduled to be activated at system startup, if desired, and to run periodically, with a user define period. Each TASK body contain calls to the functions it is running as well as some code, according to the TASK specific properties, as described in the examples below.

In general, BASIC TASK is less expensive to use regarding run time RAM usage, as after it complete its run it terminate and the OS free all the RAM associated with them, thus enabling reuse of this memory.

An EXTENDED TASK can never terminate after it has been activated, thus the RAM associated with it will never be freed.

However, it takes more time to activate a BASIC TASK. This is true because, once a request to activate the task has been received, it is required to initialize the RAM associated with it. On the other hand, an EXTENDED TASK is faster to react because, after it has been activated, the associated RAM will be kept and does not need to be initialized again for subsequent use.

As a general rule, use an EXTENDED TASK when the reaction time to some external event needs to be as short as possible, or when using the TASK EVENT inter-task communication mechanism. Otherwise, use a BASIC TASK. Refer to the discussion below, as well as to the OSEK/OS documentation for further details.