Page 1 of 1

Better to use task scheduler or RTOS tasks?

Posted: Fri Dec 16, 2022 6:54 am
by Acuario
Hi,
any opinions on whether it is better to use a task scheduler or RTOS tasks on a dual core ESP32?
I'm thinking of a task that, for example, sends an update every 30 seconds.
I've tried both and both work.

It 'feels' like the RTOS way is better but are there any opinions?

Also, what difference is there between:
xTaskCreatePinnedToCore with tskNO_AFFINITY and
xTaskCreate

It appears that they are the same

Re: Better to use task scheduler or RTOS tasks?

Posted: Fri Dec 16, 2022 9:26 am
by ESP_Sprite
Both work indeed, and it depends on your use case and preference wrt what to use. A (non-pre-emptive multitasking) task scheduler needs the task functions to be written in a specific way, where they always exit at some point. RTOS tasks do not need this, but inter-task communications can be harder and they use some RAM for each tasks stack.

You are right, xTaskCreate actually is an alias for xTaskCreatePinnedToCore with tskNO_AFFINITY.