why is rtkit-daemon eating 100% of my CPU?
I sometimes have an rtkit-daemon process eating 100% of my CPU and making the system unresponsive. I reboot and things are fine after that. What is rtkit-daemon supposed to do and why would it be sometimes eating up 100% of my CPU?
RealtimeKit is a D-Bus system service that changes the scheduling policy of user processes/threads to SCHED_RR (i.e. realtime scheduling mode) on request. It is intended to be used as a secure mechanism to allow real-time scheduling to be used by normal user processes. Overall, I would not expect it to peg out CPU usage. What happens if you let it run its course and do not reboot? I would be curious to know how long rtkit-daemon is active at any given instance.
This noxious little program is one of many reasons I avoid anything with a pulseaudio dependency. It should be safe. Safety does not mean it will be respectful of user resources, e.g. cpu usage, so it can cause inconvenience, as you noticed. It would, however, be an ideal program to corrupt for nefarious purposes because its name always alarms, and then a quick google search allays all fear. Since the program is obnoxious by design, a corrupt version monopolizing resources would not raise many eyebrows.
You can partially check its safety by running:
ps aux | grep [r]tkit-daemon
which should show the program running is /usr/lib/rtkit/rtkit-daemon which being a system file is harder to overwrite.
The main issue is that genuine real-time privilege at the user level is rarely necessary. That this runs by default, mostly sitting idle, but occupying virtual memory is just one of the many bad design 'features' of pulse audio. That it periodically kicks in hogging resources just makes it worse.