You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to run a Zephyr application using the Native-POSIX board target with real time priorities under Linux.
But, when Zephyr executes, all threads have a Linux priority of 20, which is not sufficient for real time behavior.
In my application, I can get to the main thread's PID via the pthread_self(). Using this ID, I can runtime elevate the one main thread priority. But this is only 1 of the 12 threads in the application, 11 threads are created by Zephyr itself via kernel configuration and device drivers.
I really want to preserve as much as possible the relative thread priorities assigned via the Zephyr application and configuration -- but these settings in Zephyr do not match Linux priorities.
The function zephyr_to_posix_priority in source file /zephyr/lib/posix/pthread.c looks to accomplish what I desire, that is assign a real time Linux priority to the application threads, mapping Zephyr priorities to Linux priorities BUT I am unable to get Zephyr configured to use Native Linux pthreads for the Native-POSIX board target. If that is possible, please provide some guidance.
In the absence of a solution described above, I would like to enumerate through all child threads of the main Zephyr application thread, and then reassign the thread real time priorities. One challenge in that process, would be to get not only the PID of each thread, but some other identifying characteristic (such as thread name or Zephyr assigned priority) to allow me to assign an appropriate mapped Linux thread priority.
Under Linux, I can use something like the following to get the child thread IDs, but I have no way of knowing what the thread does or the mapping:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I need to run a Zephyr application using the Native-POSIX board target with real time priorities under Linux.
But, when Zephyr executes, all threads have a Linux priority of 20, which is not sufficient for real time behavior.
In my application, I can get to the main thread's PID via the pthread_self(). Using this ID, I can runtime elevate the one main thread priority. But this is only 1 of the 12 threads in the application, 11 threads are created by Zephyr itself via kernel configuration and device drivers.
I really want to preserve as much as possible the relative thread priorities assigned via the Zephyr application and configuration -- but these settings in Zephyr do not match Linux priorities.
The function zephyr_to_posix_priority in source file /zephyr/lib/posix/pthread.c looks to accomplish what I desire, that is assign a real time Linux priority to the application threads, mapping Zephyr priorities to Linux priorities BUT I am unable to get Zephyr configured to use Native Linux pthreads for the Native-POSIX board target. If that is possible, please provide some guidance.
In the absence of a solution described above, I would like to enumerate through all child threads of the main Zephyr application thread, and then reassign the thread real time priorities. One challenge in that process, would be to get not only the PID of each thread, but some other identifying characteristic (such as thread name or Zephyr assigned priority) to allow me to assign an appropriate mapped Linux thread priority.
Under Linux, I can use something like the following to get the child thread IDs, but I have no way of knowing what the thread does or the mapping:
ls /proc/924175/task
924175 924177 924178 924179 924180 924181 924182 924183 924184 924185 924186 924187 924188
Could I use something like k_thread_foreach() API to obtain all threads in the system.
Would the user_data provide information necessary to get the Zephyr assigned thread priority?
The Shell Interface "kernel threads" command for this application yields the following as a reference;
Beta Was this translation helpful? Give feedback.
All reactions