Hardware Reference
In-Depth Information
Such a scheme is characterized by a forever loop containing an instance of the periodic
task that terminates with a blocking primitive ( end instance() ), which has the effect
of suspending the task until its next activation. When following such a programming
scheme (called extended task in OSEK/VDX), the task is always present in the stack,
even when waiting for its next activation. In this case, the stack cannot be shared and
a separate stack space must be allocated for each task.
To enable stack sharing, OSEK/VDX provides support for basic tasks , which are spe-
cial tasks that are implemented in a way more similar to functions, according to the
following scheme:
int local;
Task x() {
do instance();
}
system initialization() {
initialization();
...
}
With respect to extended tasks, in basic tasks, the persistent state that must be main-
tained between different instances is not stored in the stack, but in global variables.
Also, the initialization part is moved at system initialization, because tasks are not dy-
namically created, but they exist since the beginning. No synchronization primitive is
needed to block the task until its next period, because the task is activated every time
a new instance starts. Finally, the task cannot call any blocking primitive; therefore, it
can either be preempted by higher priority tasks or execute until completion. In this
way, the task behaves like a function, which allocates a frame on the stack, runs, and
then cleans the stack frame. For this reason, such tasks do not occupy stack space
between two executions, allowing the stack to be shared among them.
Concerning task management, OSEK/VDX kernels provide support for Fixed Priority
Scheduling with Immediate Priority Ceiling (see Section 7.5) to avoid the Priority
Inversion problem. The usage of Immediate Priority Ceiling is supported through the
specification of the resource usage of each task in the OIL configuration file. The
OIL Compiler computes the resource ceiling of each task based on the resource usage
declared by each task in the OIL file.
Search WWH ::




Custom Search