TIL using realtimekit you can get high nice levels for your programs as a user. how to set your current shell to nice -11:

$ busctl call org.freedesktop.RealtimeKit1 /org/freedesktop/RealtimeKit1 org.freedesktop.RealtimeKit1 MakeThreadHighPriorityWithPID tti -- $$ 0 '-11'

replace $$ with your PID if you don't want the current shell to be changed


you can even make some programs realtime, as long as they limit their maximum usage. so with a python session that you've run this in:

import resource
resource.setrlimit(resource.RLIMIT_RTTIME, (200000,200000))

you can run from another shell:

$ busctl call org.freedesktop.RealtimeKit1 /org/freedesktop/RealtimeKit1 org.freedesktop.RealtimeKit1 MakeThreadRealtimeWithPID ttu -- 32630 0 20

replace 32630 with your python programs' PID and now it gets 200ms of execution time every period

in general the linux scheduler is fairly interesting- it has modes that don't preempt so you can use linux a bit like DOS, modes that give tasks a guaranteed chunk of CPU time each period, and then the regular scheduler that gives each running process an equal amount of time, with weights like nice levels that let some processes have more or less time than others

Show thread

each task having an equal amount of time can be a bit silly so linux will group tasks by default, or this can be done using cgroups. idk much about SCHED_DEADLINE but it's even harder than realtime

Show thread

@jookia For realtime audio SCHED_FIFO is or at least was popular.

Sign in to participate in the conversation

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!