Better to use task scheduler or RTOS tasks?

Acuario
Posts: 5
Joined: Mon Apr 04, 2016 11:21 am

Better to use task scheduler or RTOS tasks?

Postby Acuario » Fri Dec 16, 2022 6:54 am

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

ESP_Sprite
Posts: 9727
Joined: Thu Nov 26, 2015 4:08 am

Re: Better to use task scheduler or RTOS tasks?

Postby ESP_Sprite » Fri Dec 16, 2022 9:26 am

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.

Who is online

Users browsing this forum: mike_dawes and 67 guests