In my ongoing struggle to get the best performance out of the ESP32 family... is there any benefit in pinning tasks that communicate (via any FreeRTOS mechanisms) to the same CPU core or does it not matter? I'm asking because of potential cache locality benefits and similar things I (vaguely) remember from other CPU architectures.
How do you pin your tasks to cores?
Core Affinity: Best Practices
-
- Posts: 1706
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: Core Affinity: Best Practices
I don't think there is any benefit in terms of synchronization "efficiency", as in, there's no performance gain or penalty for FreeRTOS to schedule a woken-up task to one core or the other. Deep, deep down in the bowels of the FreeRTOS scheduler there will be some inter-core communication happening to cause a context switch on the, from the scheduler's perspective, other core, but that's probably insignificant relative to the ~10us any context switch will take anyway.
Accesses to internal RAM happen directly from either core; there's no CPU cache, so no cache synchronization/locality effects between cores.
Accesses to internal RAM happen directly from either core; there's no CPU cache, so no cache synchronization/locality effects between cores.
I don't if I don't have to. Pinning tasks to cores restricts concurrency, which is rarely what I want.How do you pin your tasks to cores?
Who is online
Users browsing this forum: No registered users and 118 guests