Different Priorities

The task priority of FreeRTOS is tested on the new AEMB processor. The previous programs tested all contains tasks of equal priorities with the idle task. Therefore, higher priority tasks are to be tested to see their effect on the new AEMB processor. Will the higher priority tasks act independent of the idle task, or will they run together with the idle task? Each program are run with the presence of the infinite loop.

Task 1 (priority 1) and idle task
Similar to previous program of task 1 (6C,6D) and idle task , the program is change a bit with task 1 now having a higher priority of 1. At each interrupt, the previous address and the newer address of each thread is determine to check which task is running.
L3 interrupt

start int1 int2 int1 int2 int1 int2
thread0 T1 T1 T1 T1 T1 T1 T1
thread1 L L L L L L L

The idle task did not run at all, instead only task 1 run on thread 0 and the infinite loop (95,96) on thread 1. So, another task is added into the fray.

Task 1 (priority 1), Task 2 (priority 1) and idle task
L4 interrupt

start int1 int2 int1 int2 int1 int2
thread0 T2 T1 T1 L L T2 T2
thread1 L L T2 T2 T1 T1 L

Task 2 (6D,6E on thread 0) and the infinite loop (9F,A0 on thread 1) run at the start of the scheduler. At the first interrupt, thread 0 switch to task 1 (6C,6D) while thread 1 remains unchanged. At the next interrupt, thread 1 switch to task 2 while thread 0 continues running task 1. The following interrupt though, thread 0 switch to the infinite loop. This pattern continues without idle task running.

Task 1 (priority 2), Task 2 (priority 1) and idle task
The priority of task 1 is now changed to an even higher priority. This is to check if the different priority tasks have the same outcome as the idle task in the previous two programs.
L5 interrupt

start int1 int2 int1 int2 int1 int2
thread0 T1 T1 T1 T1 T1 T1 T1
thread1 L L L L L L L

At the start, thread 0 run task 1 while thread 1 run the infinite loop. At each interrupt, the thread that was interrupted switch into its previous running task. Task 2 and idle task are never run. Therefore, the behavior of FreeRTOS is that inside the shared queue, only the higher priority task are run. Also, the infinite loop that was run at the start for thread 1, will be send back into the queue as one of the highest priority task. If possible, this infinite loop should not be send into the queue but called only when needed.

You may also like...

Leave a Reply