I noticed that a pulseaudio
process on my Gentoo Linux machine has the nice level of -11. But I don't know how it has gained such a high priority regardless of being owned by a normal user.
I know a non-root user can launch a program only with a lower priority than 0 with the nice
command, and it says "Permission denied" if we try to give a process a higher priority than 0.
Because the pulseaudio
process is owned by me (a non-root user), I think it cannot get such a high priority without any special treatment.
So, my question is what "treatment" does enable pulseaudio
to have a low niceness value.
Best Answer
PulseAudio requires higher priority than other desktop programs mainly to avoid latency problems and get a skip-free audio playback. But the process that allows PulseAudio to have a higher priority is rather complex.
To get this special priority, it uses the RealtimeKit (
rtkit-daemon
) process. This D-Bus service allows some user programs to use real-time scheduling and enforces some strict policies to prevent abuse:More related information:
set_scheduler(int rtprio)
function source that implements this