Hardware Reference
In-Depth Information
max priority
min priority
255
0
t
0
MAXDLINE - 255
MAXDLINE
Figure 10.11
Mapping NRT priorities into deadlines.
10.4.2
TASK CLASSES AND SCHEDULING
ALGORITHM
Real-world control applications usually consist of computational activities having dif-
ferent characteristics. For example, tasks may be periodic, aperiodic, time-driven, and
event-driven and may have different levels of criticality. To simplify the description of
the kernel, only two classes of tasks are considered in DICK:
HARD tasks, having a critical deadline, and
non-real-time (NRT) tasks, having a fixed priority.
HARD tasks can be activated periodically or aperiodically depending on how an in-
stance is terminated. If the instance is terminated with the primitive end cycle , the task
is put in the idle state and automatically activated by the timer at the beginning of its
next period; if the instance is terminated with the primitive end aperiodic , the task is
put in the sleep state, from where it can be resumed only by explicit activation. HARD
tasks are scheduled using the Earliest Deadline First (EDF) algorithm, whereas NRT
tasks are executed in background based on their priority.
In order to integrate the scheduling of these classes of tasks and avoid the use of two
scheduling queues, priorities of NRT tasks are transformed into deadlines so that they
are always greater than HARD deadlines. The rule for mapping NRT priorities into
deadlines is shown in Figure 10.11 and is such that
d NRT
i
= MAXDLINE
PRT LEV + P i ,
where MAXDLINE is the maximum value of the variable sys clock (2 31
1),
PRT LEV is the number of priority levels handled by the kernel, and P i is the priority
of the task, in the range [0, PRT LEV-1] (0 being the highest priority). Such a priority
mapping slightly reduces system lifetime but greatly simplifies task management and
queue operations.
Search WWH ::




Custom Search