Hacker News new | ask | show | jobs
by flatiron 1043 days ago
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
    }
  }
}