-
Notifications
You must be signed in to change notification settings - Fork 24
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
Extend platform API with functions for setting thread scheduling policy, core affinity and priority + remove C11 as platform #355
Conversation
Also provide an POSIX implementation of this API. Currently it defaults to SCHED_FIFO. This is debatable.
@soyerefsane, this should make your benchmarking easier. Here is an example program using this API: https://github.com/lf-lang/lingua-franca/blob/thread-scheduler-api/test/C/src/concurrent/ThreadScheduling.lf Note that you can not change thread scheduling from user space, a simple fix is to run the program with sudo. |
What is the status of this PR? The changes look very useful to me. |
I havnt had the time to revisit this draft again. I think it is quite complete. I will need to look through it again. There is a couple of unanswered questions still. I have updated the PR with a checklist of missing items. |
This branch has relatively simple conflicts with main. Is it OK to just overwrite main so we can get the tests to run? |
I can solve the conflicts. Two secs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did a self-review and I believe it looks OK now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only nitpicks regarding comments from my side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me! I added some small suggestions, mostly about documentation. Let's merge this!
Co-authored-by: Marten Lohstroh <[email protected]>
…ctor-c into thread-scheduler-api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback now I have improved the implementation to map a priority in the range [LF_SCHED_MIN_PRI, LF_SCHED_MAX_PRI] to the range of the target platform.
Looks like Arduino is now failing... |
Our Arduino-support is really frustrating as adding source files and header files in reactor-c must be accompanied by changes to our compiler to move/delete files because the |
This PR adds the following functions to the platform API:
It provides implementations for POSIX and Zephyr. It also removes the C11 as a platform because it provides a strict subset of the functionality of the POSIX and Windows platforms which we already support. I have not heard about any platform not supporting POSIX (or windows) that does support C11.
I view this thread scheduling API as experimental and that it is likely to be changed in the future when we start using it with things like enclaved scheduling. The reason to add it now, before we use it in the runtime, is to enable the user to write real-time programs by setting a high priority and a real-time scheduling policy for their workers.
TODOs:
lf_thread_self()
andlf_thread_id()
Closes #290