Cooperative and Preemptive Scheduling. ETAS INTECRIO

Add to My manuals
178 Pages

advertisement

Cooperative and Preemptive Scheduling. ETAS INTECRIO | Manualzz

ETAS The INTECRIO Components reduces the required computing power at runtime and the memory requirement since it is not necessary to manage a high number of processes/RE but only a much smaller number of tasks.

Each task is assigned a static priority . Tasks activated at runtime are handled according to their respective priority. A task with a higher priority takes precedence over a task with a lower priority. Different tasks can have the same priority. If these tasks are scheduled for execution at the same time, they are arranged in a FIFO queue and processed based on the principle "First come, first served."

Dynamic scheduling is handled in accordance with a status model for the tasks. Upon activation, a task is changed to the status activated . If its priority is higher than that of the running task and if switching is possible, it is started (the latter translates to a direct transition from the status "inactive" to the status

"running") while the execution of the current task is interrupted (the task is changed to the status "activated"). At the end of the running task, i.e. when it changes to the status inactive , the activated task with the highest priority and at the first position of the respective FIFO queue is started or continued (if this

task was previously interrupted). Fig. 5-22 shows the existing task states and

all possible transitions.

Activated

Interrupt

Activate

Start

Running

Start

Terminate

Inactive

Fig. 5-22 Task states and transitions

5.8.1.3

Cooperative and Preemptive Scheduling

There are two possible methods for switching between a running task and an activated task with higher priority. The first switches the execution at predefined locations of the software. These predefined locations are the boundar-

INTECRIO V4.7 - User’s Guide 92

ETAS The INTECRIO Components ies between the processes/RE of a task. Since the task with the higher priority is waiting until the running process/RE finishes, this method is referred to as cooperative scheduling

(see Fig. 5-23).

Priority

Activate task B

Start task B

Task B p1

B p2

B p3

B p4

B p5

B

Task A p1

A p2

A p3

A p4

A

Time

Fig. 5-23 Cooperative scheduling

NOTE

Cooperative scheduling is not available for RTA-OSEK.

The advantage of cooperative scheduling is the efficient utilization of resources. The design ensures that access to resources, such as stack, register or messages, is exclusive. In addition, there is no need to secure the process/RE context when switching takes place; all processes/RE can be executed using the same register bank. The disadvantage of cooperative scheduling is the relatively slow response time that is dependent upon the longest execution time of the processes/RE.

The second strategy– preemptive scheduling –allows for switching the execution inside the processes/RE at the boundaries of machine instructions (provided that the interrupts are not deactivated).

The scheduler is, therefore, capable of interrupting the currently running process/RE of a task and starting the execution of a task with higher priority (see

Fig. 5-24).

Priority

Activate task B

Start task B

Task B p1

B p2

B p3

B p4

B p5

B

Task A p1

A p2

A

Interruption ...

p2

A p3

A p4

A

… Continuation of p2

A

Time

Fig. 5-24 Preemptive scheduling

INTECRIO V4.7 - User’s Guide 93

advertisement

Related manuals

Download PDF

advertisement

Table of contents