Answer the question
In order to leave comments, you need to log in
How to limit the CPU for a script?
Good afternoon. There is a simple bash script. It downloads and unpacks\adds and launches the LXC container
. The machine is weak, background music plays from it in the "hall", so it should not lag/slow down. The problem is that when unpacking and adding the container, the CPU is heavily loaded, background processes slow down. We need to limit our consumption. How to do it right?
Several commands that actually load the CPU
sudo lxc list (this is the first time when initialization and auto-creation of confs \ certificates takes place)
sudo lxc image import /root/myLXC.tar.gz --alias LXC-base (actually unpacking the archive with the container)
Answer the question
In order to leave comments, you need to log in
pack the process into a separate cgroups slice and
restrict the slice then all spawned subprocesses will have slice restrictions.
https://habr.com/ru/company/redhatrussia/blog/423051/
and a bunch of other similar
ones, although you need it one-time, then fuck all the tricks, just increase the priority of the audio player through htop.
well, after starting the unpacking, lower the priority of gzip to the "skirting board", it alone will eat up all the free space of the processor, but in general it will not be able to interfere with anyone.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question