CPULimit
Sample
sudo apt-get install cpulimit
cpulimit -p [pid] -l [percentage]
Test
cat << EOF > load.py i = 0 while True : i += 1 EOF
python load.py &
top ================================ PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 4128 user 25 5 21608 5928 3464 R 100.0 0.3 0:03.53 python ================================
cpulimit -p 4128 -l 5 &
top ================================ PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 4128 user 25 5 21608 5928 3464 R 5.6 0.3 5:11.00 python ================================
Acknowledgments
Daiphys is a professional-service company for research and development of leading-edge technologies in science and engineering.
Get started accelerating your business through our deep expertise in R&D with AI, quantum computing, and space development; please get in touch with Daiphys today!
Daiphys Technologies LLC - https://www.daiphys.com/