You can't really get a process to run less. You can use
nice to give it a lower priority, but that's in relation to other processes. The way to run the CPU cooler while a process runs is to use
usleep(3) to force the process out of the run state a certain amount of time, but that would involve either patching
tar or using the
LD_PRELOAD mechanism to provide a patched function that
tar uses a lot (e.g.
I suspect your best workarounds are the hardware ones you've mentioned on SuperUser: keeping the laptop cool and/or lowering the CPU clock.
An annoying but possibly viable workaround (a kludge, really) works at a ‘macroscopic’ level. Rather than making
tar run 100ms every 200ms, you could make it run one second out of every two. Note: this is a horrible, horrible kludge. But hey, it might even work!
tar cjf some-file.tar.bz2 /some-directory &
while true; do
sleep 1 # Let it run for a second
kill -STOP $! 2>/dev/null || break
sleep 1 # Pause it for a second
kill -CONT $! 2>/dev/null || break
sleep adjusts sleep time, the second one adjusts runtime. As it stands now, it's got a 50% duty cycle. To keep the temperature down, you will very likely need to reduce the duty cycle to perhaps 25% or lower (1 second run, 3 seconds sleep = 1 of every 4 seconds = 25% duty cycle). The shell command
sleep can take fractional times, by the way. So you could even say
sleep 0.1. Keep it over 0.001 just to be sure, and don't forget that script execution adds to the time too.