I have experimented with ‘cset’ to shield music processes (mpd, spotify) in a dedicated CPU, moving most other processes to the remaining ‘system’ set of CPUs, and setting the process priority to RT.
This brings a useful improvement to audio quality. It looks pretty simple to package this up in a system plugin.
Would anyone else be interested in this?
At present I have created some bash scripts .
The ‘cset’ package has a ‘shield’ function. This separates the CPUs into two sets: ‘user’ and ‘system’. The shield command creates a ‘user’ set and moves most processes into ‘system’.
Allocating 1 CPU to ‘user’ via the shield command means that the processes running ‘user’ have fewer competing processes for that CPU.
This is the script that needs to be run once to install cset, once Volumio is installed:
apt-get update apt-get install cpuset
This is the script that needs to be run after volumio has started, to create the shield and move mpd and vollibrespot into the ‘user’ set (allocating CPU 0 to the ‘user’ set):
cset shield -c 0-0 pids=$(pgrep -x mpd) for pid in $pids do chrt -r -p 99 $pid cset proc --move --threads --toset=user --force --pid=$pid done pids=$(pgrep -x vollibrespot) for pid in $pids do chrt -r -p 99 $pid cset proc --move --threads --toset=user --force --pid=$pid done