Which should be the first task to run in SMP port

Hi,

I am porting FreeRtos for Arm R8 processor. In my SMP version, the first task to run is prvIdleTask(). This then calls portYIELD(), and finally, my timer runs after a few more calls.
While in a non-SMP version that our team ported, the first task to run is prvTimerTask. Is this the correct behavior for both, SMP and non-SMP version? If not, then what is?

The intended behavior should be that the “current tasks” at startup should be the highest priority tasks.

A couple of things to quickly note, since you say SMP, that means that there isn’t A task that starts, but one should start on each core, and normally, the timer task will have the highest priority, so it should start on SOME code.

If the parameter configRUN_MULTIPLE_PRIORITIES is set to 0, then ONLY task of equal priority will run, and if there aren’t enough to fill the cores, then an idle task will be scheduled for that core (this option is to get around program assumptions from single core systems that you block lower priority tasks when you are running).

Multi-core debugging can be tricky, so you may want to confirm what you are seeing with some instrumentation.

Hi Zaid,

In a SMP environment, the first task to run on each core is the idle task or the passive idle task. This idle task then performs an initial yield, allowing the application tasks to be scheduled and executed.

However, this may not be the reason for your observation regarding the timer task. Assuming the timer task has the highest priority in the system, if there are other tasks with the same highest priority or if configRUN_MULTIPLE_PRIORITIES is set to 1, it is possible that the timer task runs after a few more calls in the SMP environment. This is because multiple tasks can run concurrently on different cores.

1 Like