2b-t / docker-realtime

Guide on how to use Docker for real-time applications with Linux and the Ubuntu realtime-kernel/PREEMPT_RT patch with a focus on robotics with ROS and ROS 2
MIT License
234 stars 27 forks source link

Reduce real-time priority to 98 #3

Closed simutisernestas closed 1 year ago

simutisernestas commented 1 year ago

was reading upon it, here seems like it's a bad idea to set RT priority to max 99 : )

2b-t commented 1 year ago

Hi @simutisernestas , Thanks for your merge request. I have heard as well that you should not put your thread's real-time priority to 99 and instead leave it below the priority of kernel threads (some say 98, others say 90-95 or even lower values depending on your application). Yet the rtprio set there is only the maximum realtime priority allowed inside the container. It is what you see when you type $ ulimit -a inside it and you are free to set any priority within these limits for your user threads, e.g. with chrt --rr 98 <command>. While I agree that for most people running their threads with an rtprio of 99 is likely not what they want, I do not know if there are not cases where setting such an rtprio might actually be desirable. Therefore I passed this responsibility on to the user inside the container, so they might still decide if it is something they want to use or not. This seems to be what the Docker of the pendulum demo does with the command --ulimit rtprio=100:100 as well. While I am not sure if this is something that should be changed, I agree that at least a comment pointing this out somewhere might be beneficial for somebody not familiar with the topic.

simutisernestas commented 1 year ago

I've reverted to 99, but left the comment in case you wish to keep it :)