OSEK/VDX
Operating System
Specification 2.2
16 © by OSEK OSEK OS 2.2
4 Task management
4.1 Task concept
Complex control software can conveniently be subdivided in parts executed according to their
real-time requirements. These parts can be implemented by the means of tasks. A task
provides the framework for the execution of functions. The operating system provides
concurrent and asynchronous execution of tasks. The scheduler organises the sequence of task
execution.
The OSEK operating system provides a task switching mechanism (scheduler, see chapter 4.4,
Task switching mechanism), including a mechanism which is active when no other system or
application functionality is active. This mechanism is called idle-mechanism. Two different
task concepts are provided by the OSEK operating system:
• basic tasks
• extended tasks
Basic Tasks
Basic tasks only release the processor, if
• they terminate,
• the OSEK operating system switches to a higher-priority task, or
• interrupt occurs which cause the processor to switch to an interrupt service routine
(ISR).
Extended Tasks
Extended tasks are distinguished from basic tasks by being allowed to use the operating
system call WaitEvent, which may result in a waiting state (see chapter 7, Event mechanism,
and chapter 13.5.3.4, WaitEvent). The waiting state allows the processor to be released and to
be reassigned to a lower-priority task without the need to terminate the running extended task.
In view of the operating system, management of extended tasks is, in principal, more complex
than management of basic tasks and requires more system resources.
4.2 Task state model
The following text describes the task states and the transitions between the states for both task
types.
A task must be able to change between several states, as the processor can only execute one
instruction of a task at any time, while several tasks may be competing for the processor at the
same time. The OSEK operating system is responsible for saving and restoring task context in
conjunction with task state transitions whenever necessary.
4.2.1 Extended tasks
Extended tasks have four task states:
running In the running state, the CPU is assigned to the task, so that its instructions
can be executed. Only one task can be in this state at any point in time,
while all the other states can be adopted simultaneously by several tasks.