A better thermostat
Paul Crowley wrote “On a modern PC, the motherboard controls the power to the CPU fan, and has sensors that monitor the temperature of the CPU and the speed at which the fans are spinning. The slower the fan spins, the quieter it is, so it's desirable to monitor the CPU temperature and adjust the fan speed appropriately.
Under Linux, the lm-sensors package is responsible for hardware monitoring and control. It comes with a script, "fancontrol", which is meant for this exact job; every ten seconds, it reads the CPU temperature, and adjusts the fan power. This way it can trade off a hotter CPU for a quieter system, while keeping the CPU temperature within acceptable limits.
Unfortunately, its algorithm for choosing the fan power doesn't work well on my system.”