Hacker News new | ask | show | jobs
by themulticaster 1753 days ago
If you're using Linux, you could try the deadline scheduler policy (SCHED_DEADLINE, see sched(7) [1]), especially if the tick runtime can be estimated to an extent. Essentially, you set the task period (60 Hz in your case), the task runtime (a rough upper bound for the task execution time) and a deadline, and the Linux scheduler will make sure your task runs at an appropriate time every period. It will also throttle tasks that exceed their budget (by running over their allotted runtime) and it won't admit tasks if it's impossible to run them (since the sum of task runtimes exceeds the available runtime).

[1] https://www.man7.org/linux/man-pages/man7/sched.7.html