Hacker News new | ask | show | jobs
by anthk 1041 days ago
You could use Rain to cool down your CPU. That tool was useful under VM's and DOSBox too.
1 comments

On Pentium or higher. 486s and earlier didn’t really have an HLT instruction, iirc
>> All x86 processors from the 8086 onward had the HLT instruction, but it was not used by MS-DOS prior to 6.0[2] and was not specifically designed to reduce power consumption until the release of the Intel DX4 processor in 1994. MS-DOS 6.0 provided a POWER.EXE that could be installed in CONFIG.SYS and in Microsoft's tests it saved 5%.[3]
I stand corrected, I was under the impression that the original Pentium was the first architecture that had HLT, but maybe that was the first architecture I ran Rain on, since it had benefits (having ran Win95 on a 586, but never DOS on a 486 laptop)
Idle loops are harder to implement when your system doesn't have multitasking.
Even single tasked systems like MS-DOS still had interrupts. You could HLT the processor and a keyboard interrupt could wake it straight back up and resume execution anywhere in the MS-DOS kernel. It's just that the typical TDP of a CPU back then was a couple of watts so there was literally no point in HLTing instead of busy-waiting so nobody bothered.
every x86 has had halt. win95 was just not using it even though you could write a 10 line program to get context switched in when idle that would halt it. it was one of my first programs as a child on a 486 66 dx2.

i just had chat gpt generate said program and i think its very similar to what I wrote. I'm unsure if it ever did anything but i've always been interested in efficiency:

#include <stdio.h>

#include <windows.h>

void main() {

  printf("Setting process priority to low...\n");

  SetPriorityClass(GetCurrentProcess(), IDLE_PRIORITY_CLASS);

  printf("Halting the processor when no other programs are running...\n");

  while (1) {
    __asm {
      hlt
    }
  }
}