Snakeoil OS
Moderator: Staff
-
- Very active member
- Posts: 775
- Joined: 2018-08-28 11:10
- Location: Scotland
Re: Snakeoil OS
<t>My house move has concluded and I have much sorting out to do.<br/>
<br/>
As part of my break from unpacking boxes I will shortly post clips covering both the Hakai and the Tinker Board S. And also a Hakai to be built using a case from China (cost around £60 including the PSU (https://www.ebay.co.uk/itm/RGeek-Comput ... 2749.l2649).<br/>
<br/>
I'm fascinated by the efforts put into Debian Stretch. Use SO and choose from a large number of versions of MPD and other players and servers. Increasing the number of choices available usually makes for a better outcome. The latest update by Agent Kith includes a first attempt at offering the ability to play directly from RAM with further development of this functionality to come. I applaud Kith's diligence and desire to keep pushing the boundaries of the SnakeOil OS. Fredrik and Kith are heroic in an age of chaos. <br/>
<br/>
I just need to take delivery of my Synology router to take my ISP out of the equation - part of my side project to give my new house a small business network with the aim of delivering state of the art networking and audio functionality. It's giving me home automation and hopefully keeping the amount and size of visible cables to a minimum.</t>
<br/>
As part of my break from unpacking boxes I will shortly post clips covering both the Hakai and the Tinker Board S. And also a Hakai to be built using a case from China (cost around £60 including the PSU (https://www.ebay.co.uk/itm/RGeek-Comput ... 2749.l2649).<br/>
<br/>
I'm fascinated by the efforts put into Debian Stretch. Use SO and choose from a large number of versions of MPD and other players and servers. Increasing the number of choices available usually makes for a better outcome. The latest update by Agent Kith includes a first attempt at offering the ability to play directly from RAM with further development of this functionality to come. I applaud Kith's diligence and desire to keep pushing the boundaries of the SnakeOil OS. Fredrik and Kith are heroic in an age of chaos. <br/>
<br/>
I just need to take delivery of my Synology router to take my ISP out of the equation - part of my side project to give my new house a small business network with the aim of delivering state of the art networking and audio functionality. It's giving me home automation and hopefully keeping the amount and size of visible cables to a minimum.</t>
Carl Sagan: Extraordinary claims require extraordinary evidence.
- springwood64
- Very active member
- Posts: 940
- Joined: 2008-10-13 18:19
- Location: UK
Re: Snakeoil OS
If you use mpd and upmpdcli on a SnakeOil OS player, you may have tried to use the cpuset and process priority options to segregate mpd onto its own CPU and to run as a real time process. You will need to enable the 'snakeoil' features to access these options.
However, with SO 1.1.9 U9, the cpuset and process priority settings only affect upmpdcli.
I've created a script to set the mpd priority to real time and to move mpd to user:
Create new file mpdpriority.sh with the following lines:
You can then run this manually as
To my ears this brings a worthwhile improvement.
A future release of SO will probably fix this, but in the meantime you can use the above as a work around.
You need to be happy with basic Linux command line tools. Thanks to agent_kith for the magic runes.
However, with SO 1.1.9 U9, the cpuset and process priority settings only affect upmpdcli.
I've created a script to set the mpd priority to real time and to move mpd to user:
Create new file mpdpriority.sh with the following lines:
Code: Select all
pids=$(pgrep -x mpd)
for pid in $pids
do
chrt -r -p 99 $pid
cset proc --move --threads --toset=user --force --pid=$pid
done
Code: Select all
sudo sh [path to script file]/mpdpriority.sh
A future release of SO will probably fix this, but in the meantime you can use the above as a work around.
You need to be happy with basic Linux command line tools. Thanks to agent_kith for the magic runes.
Last edited by springwood64 on 2020-11-14 11:27, edited 1 time in total.
Pete
- springwood64
- Very active member
- Posts: 940
- Joined: 2008-10-13 18:19
- Location: UK
Re: Snakeoil OS
Updated to allow for multiple mpd processes and ditched the reboot call as it doesn't seem to work
Pete
- springwood64
- Very active member
- Posts: 940
- Joined: 2008-10-13 18:19
- Location: UK
Re: Snakeoil OS
Some progress. I now have a crude but reliable process for applying the script after a reboot.
I add a line to crontab that waits for 10 minutes after a reboot and then applies the script:
I have not experimented with shorter sleep times, as this seems pretty reliable.
I add a line to crontab that waits for 10 minutes after a reboot and then applies the script:
Code: Select all
#crontab-e
@reboot sleep 600; sh [path to script file]/mpdpriority.sh
Pete
- springwood64
- Very active member
- Posts: 940
- Joined: 2008-10-13 18:19
- Location: UK
Re: Snakeoil OS
Anyone here experimented with CPUSet and process priority?
I've been experimenting for the last few weeks and settled on a config that seems very nice. If anyone is interested I'll post the config: it would be nice to hear if others think it brings an improvement.
I've been experimenting for the last few weeks and settled on a config that seems very nice. If anyone is interested I'll post the config: it would be nice to hear if others think it brings an improvement.
Pete
Re: Snakeoil OS
Interested especially if they are applicable beyond Snakeoil to Volumio &/or Debian/MPD as well. If so, would likely be worth a new thread...springwood64 wrote: ↑2020-11-11 18:48 Anyone here experimented with CPUSet and process priority?
I've been experimenting for the last few weeks and settled on a config that seems very nice. If anyone is interested I'll post the config: it would be nice to hear if others think it brings an improvement.
Also curious in the method for comparing - is it an easy change so as to be able to do a quick comparison back & forth, or a bit more complicated?
Re: Snakeoil OS
Haven’t tried any tweaks in Snakeoil yet.springwood64 wrote: ↑2020-11-11 18:48 Anyone here experimented with CPUSet and process priority?
I've been experimenting for the last few weeks and settled on a config that seems very nice. If anyone is interested I'll post the config: it would be nice to hear if others think it brings an improvement.
Would be interested, though I’ll admit to being a bit concerned about messing things up.
- springwood64
- Very active member
- Posts: 940
- Joined: 2008-10-13 18:19
- Location: UK
Re: Snakeoil OS
There are two Linux mechanisms involved, which Snakeoil makes easier to apply. I find both are beneficial and it appears that combining them delivers more than the sum of the parts.
I have not tested every permutation of CPU allocation, just combinations of 3 for user and 1 for system. The image below shows the 3:1 permutation that sounds best to me. Having read further about Linux scheduling, it is possible that 1 for user and 3 for system could sound better and I plan to try this later.
Initially I followed the recommendation to allocate real time priority to all the processes that appear active during music playback. However, paring this down to just upmpdcli, mpd and the interrupt that writes to usb (xhci-hc) sounds best. Note that the latter process can be named differently in different environments. In mine it is called irq/119-xhci_hc
I have noticed that over time more and more processes accumulate on the user processes, so I schedule a daily reboot:
- CPUSet Allocates processes based on user to specific processors. Snakeoil uses this to separate music players from the rest of the system. Snakeoil uses the Ubuntu cpuset package and my script also uses it to overcome a race condition on reboot and include mpd in the user CPU set.
- Process Priority Setting the process priority changes the way Linux schedules the execution of a process' instructions. Snakeoil provides a simple way of making selected processes real time, ensuring they are less likely to be interrupted during time-sensitive execution
I have not tested every permutation of CPU allocation, just combinations of 3 for user and 1 for system. The image below shows the 3:1 permutation that sounds best to me. Having read further about Linux scheduling, it is possible that 1 for user and 3 for system could sound better and I plan to try this later.
Initially I followed the recommendation to allocate real time priority to all the processes that appear active during music playback. However, paring this down to just upmpdcli, mpd and the interrupt that writes to usb (xhci-hc) sounds best. Note that the latter process can be named differently in different environments. In mine it is called irq/119-xhci_hc
It is easy to change. My approach is to make the config change, save it, reboot and listen. If you rely on a script you will need to run the script before listening. Generally it takes about 5-10 minutes between each change.
It is possible to apply the same mechanisms without Snakeoil and I would expect them to bring similar benefits. You could adapt the script above to include mpd, upmpdcli and the interrupt that writes to USB, provided you have installed CPUset first.
I have noticed that over time more and more processes accumulate on the user processes, so I schedule a daily reboot:
Code: Select all
#crontab -e
0 4 * * * /sbin/shutdown -r +5
@reboot sleep 600; sh [path to your version of the script]/mpdpriority.sh
You do not have the required permissions to view the files attached to this post.
Last edited by springwood64 on 2020-11-12 09:49, edited 3 times in total.
Pete
- springwood64
- Very active member
- Posts: 940
- Joined: 2008-10-13 18:19
- Location: UK
- springwood64
- Very active member
- Posts: 940
- Joined: 2008-10-13 18:19
- Location: UK
Re: Snakeoil OS
See https://www.lejonklou.com/forum/viewtop ... 727#p51727springwood64 wrote: ↑2020-11-12 08:45 Having read further about Linux scheduling, it is possible that 1 for user and 3 for system could sound better and I plan to try this later.
Pete
- springwood64
- Very active member
- Posts: 940
- Joined: 2008-10-13 18:19
- Location: UK
Re: Snakeoil OS
For non-snakeoil systems check out https://github.com/lpechacek/cpuset/blo ... torial.txt for information on CPU Set
Pete
- springwood64
- Very active member
- Posts: 940
- Joined: 2008-10-13 18:19
- Location: UK
Re: Snakeoil OS
The Snakeoil OS is an enthusiast project and it's future survival is not certain.
This forum thread provides a bit more information https://www.snakeoil-os.net/forums/Thre ... 57#pid3957
If you wish to contribute to it's future you can do so here: https://www.patreon.com/snakeoilos
This forum thread provides a bit more information https://www.snakeoil-os.net/forums/Thre ... 57#pid3957
If you wish to contribute to it's future you can do so here: https://www.patreon.com/snakeoilos
Pete