I want to run a long running CPU intensive programme overnight. However I don't want to hear the noisy CPU fans. The more the CPU is used, the hotter it gets and hence the fans turn on to cool it down. The usual way to limit how much a process runs is by using nice. However there won't be any process running, so it will use as much CPU as is available. Mostly this is what you want.
cpulimit (available in ubuntu), is a programme to limit what percent of CPU a process gets. It does this my constantly pausing and resuming it so that it only runs a certain amount of times per second.
This solves my problem completly, since I can limit a process to only having 15% of the CPU time. The rest of the time the CPU will be idle, so it will be cooler, so it will be quieter.
After installing it, just find the process you want to limit. then do a
cpulimit -p $PID -l $SOMEPERCENTAGEand it'll limit that process right away.