-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Freertos mutex and task switching 2 cores version (IDFGH-14654) #15400
Comments
Hi @ifedotov1984, As you can see from the screenshot you shared, both ![]() I think the illusion that Tweaking your code slightly reveals that
![]() |
It is not illusion. Also, i tested with DRAM logs, and it is same. It is all becouse, when high_0 want to take mutax, low_1 priority becomes same as high_0. |
Hi @ifedotov1984,
This explains why |
I am closing this ticket since there is no change required in ESP-IDF. Please feel free to re-open this ticket or open a new one if more support is needed. Thank you. |
Answers checklist.
General issue report
If 2 cores and mutexes are used, a situation arises where on core 1 the highest priority task (which does not use mutexes) is not executed while a task on core 0 is waiting for a mutex.
Attached is a test project with this problem.
If you run it as is, then the task high _1 will be executed after high _0 is executed, although it is on another core and does not wait for the mutex.
2) if increase the priority of high _1 above high _0 (set 12 instead of 9), then the program execution becomes as expected
3) if transfer the task high _1 with priority 9 to core 0, then the program execution becomes as expected
4) if transfer the task low _1 with priority 1 to core 0, then the program execution becomes as expected
mutex_test.zip
I found out that this happens because of FreeRTOS priority inheritance https://www.freertos.org/Documentation/02-Kernel/02-Kernel-features/02-Queues-mutexes-and-semaphores/04-Mutexes.
With one core system, it is clear why this happens.
But with 2 cores, the principle of multiple cores is violated.
It turns out that while the low-priority task is executed on the first core (and takes mutex), the high-priority one (on first core) is not executed, because the high-priority task on the zero core is waiting for a mutex.
The text was updated successfully, but these errors were encountered: