Recentemente tive a necessidade de instalar um comando para limitar os recursos de cpu a uma tarefa
Do link que você forneceu:
cputhrottle is a small OS X command-line utility.
Você não poderá executá-lo como no Linux.
Se você conseguir compilá-lo no Linux, o link também informará como executá-lo: sudo ./cputhrottle 328 25
Se você estiver executando o OSX, use bom para "executar um utilitário com prioridade de agendamento alterada"
O que é um arquivo gz e como eu abro um arquivo gz?
A GZ, or GNU Zipped Archive file is a compression utility developed by Jean-Loup Gailly and Mark Adler as a free software to replace
Compress in early Unix systems. It allows for better compression and
freedom from patented algorithms. GZ was adopted by the GNU Project,
and is relatively popular on the Internet. GZIP produces files with a
GZ extension, which can be decompressed by GUNZIP.
By default, GZIP keeps the original file name as well as the time stamp in the compressed file. These are used when decompressing the
file with the option -N. This is useful when a compressed file name
was truncated or when the time stamp was not preserved after the file
was transferred.
A file or folder, or even a group of files and folders can be selected by a user and compressed as one GZ file. Multiple GZ files
can even be compressed as one GZ file, or these GZ files can be placed
by the folder that can then be compressed as a GZ file. The GZIP
compression technology and the GZ compression format were developed
for Linux systems, though there are certain Microsoft Windows
decompression applications implemented with support for decompressing
and opening these GZ files. Gzip is normally used to compress just a
single file. Users of Mac platforms can also install and use some
compatible Mac decompression tools to open and view the archived
content of these GZ files.
How do I open a .GZ File?
In order to extract a .gz file you can use GZIP/GNUZIP program. It is a software application used for file compression. It is based on the
DEFLATE algorithm, which is a combination of LZ77 and Huffman coding.
Use o seguinte comando:
$ gunzip file.gz
Fonte O que é um arquivo gz e como eu abro um arquivo gz?
Por que preciso executar chmod + x
?
You must run "chmod +x cputhrottle" after running "gunzip cputhrottle.gz
Para executar um arquivo no Unix, ele deve ter as permissões corretas.
chmod +x
define as permissões para que o programa possa ser e X ecuted.
Veja chmod para mais informações.
Eu tenho um arquivo executável. Como eu então uso este arquivo como um comando?
Você o executa digitando seu nome. O Unix irá procurar o PATH
para tentar encontrar o comando.
Se estiver no diretório atual, o seguinte funcionará:
./cputhrottle 328 25
Adicionando sudo
antes do comando executá-lo como o superusuário:
sudo ./cputhrottle 328 25
Veja sudo para mais informações.
Restringindo o uso da CPU do processo usando nice, cpulimit e cgroups
bom
The nice command tweaks the priority level of a process so that it runs less frequently. This is useful when you need to run a CPU intensive task as a background or batch job. The niceness level ranges from -20 (most favorable scheduling) to 19 (least favorable). Processes on Linux are started with a niceness of 0 by default. The nice command (without any additional parameters) will start a process with a niceness of 10. At that level the scheduler will see it as a lower priority task and give it less CPU resources.
...
What this means in real terms is that if you want to run a CPU intensive task you can start it using nice and the scheduler will always ensure that other tasks have priority over it. This means that the server (or desktop) will remain responsive even when under heavy load.
Nice has an associated command called renice. It changes the niceness level of an already running process. To use it, find out the PID of process hogging all the CPU time (using ps) and then run renice:
...
cpulimit
The cpulimit tool curbs the CPU usage of a process by pausing the process at different intervals to keep it under the defined ceiling. It does this by sending SIGSTOP and SIGCONT signals to the process. It does not change the nice value of the process, instead it monitors and controls the real-world CPU usage.
cpulimit is useful when you want to ensure that a process doesn't use more than a certain portion of the CPU. The disadvantage over nice is that the process can't use all of the available CPU time when the system is idle.
Fonte Restringindo o uso da CPU no processo usando nice, cpulimit e cgroups