Multiprocess/task concurrency scheduling question

aaronhshi
Posts: 2
Joined: Tue Jul 24, 2018 5:35 am

Multiprocess/task concurrency scheduling question

Postby aaronhshi » Tue Jul 24, 2018 5:40 am

Wanted to clarify a question I had. ESP-IDF runs on top of FreeRTOS. From my understanding FreeRTOS is not capable of true parallel processing of running scheduled tasks concurrently. My question is does that mean ESP-IDF is also incapable of utilizing it's two cores for one app for concurrent multitasking? Does it bypass this by running two instances of FreeRTOS/apps on each core and having them communicate with each other manually?

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: Multiprocess/task concurrency scheduling question

Postby ESP_igrr » Tue Jul 24, 2018 6:15 am

Hi aaronhshi,

FreeRTOS version included in ESP-IDF has been modified to allow tasks on two CPUs to run concurrently. This was done by extending internal data structures to account for the 2nd CPU, modifying the scheduling algorithm, and adding extra critical sections to FreeRTOS source code. From user perspective, tasks running on two CPUs share the same memory and can use FreeRTOS primitives (queues, etc.) to communicate with each other pretty much like they are used in a single core scenario. The few things that are different from single core FreeRTOS are listed here: https://docs.espressif.com/projects/esp ... s-smp.html.

Deouss
Posts: 425
Joined: Tue Mar 20, 2018 11:36 am

Re: Multiprocess/task concurrency scheduling question

Postby Deouss » Tue Jul 24, 2018 11:20 am

Question - how does the cpu scaling or esp32 scaling look like?
I read some documents it is possible to connect two esp32 chips physically on one board and use them as one 4-core from app perspective

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

Re: Multiprocess/task concurrency scheduling question

Postby ESP_Sprite » Tue Jul 24, 2018 2:57 pm

That would be very hard, as there's no way to access internal memory directly from outside the ESP32; multi-core in a multi-threading environment kind-of implies that all memory is shared. I'm not sure what that paper was talking about, but the multi-threading solution as we have in esp-idf does not transparently scales between CPUs. You can still use the CPU power of multiple ESPs, but you'll have to write an application for each individual one and handle communication on that level.

Who is online

Users browsing this forum: No registered users and 137 guests