sudo apt-get install cpulimit
cpulimit -p [pid] -l [percentage]
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 ================================