Why did these 8 lines of code cause a laptop to shut off and BIOS beep instead of booting up?

StackOverflow https://stackoverflow.com/questions/20170612

  •  04-08-2022
  •  | 
  •  

Question

I was toying around with an expendable laptop, writing loops for simple entertainment, as I'm a sound technician at my High School and there was a break in rehearsals. I ended up with these 8 lines:

type = "1234567890abcdef"
while 1 == 1
     type = type.split("").shuffle.join("")
     system("color " + type[0] + type[1])
     system("start main.rb")
     r = rand(2)
     print r
end

I ran it in the cmd and after about 25 minutes it turned off, but the HDD and CPU usage lights by the mousepad stayed on. The only way to make it do anything was to remove the battery. Upon trying to start it up again, it flashed 5 times (It is a 2010 or so Toshiba laptop, I don't know what model, so we couldn't look up the BIOS codes). We managed to fix it with a CMOS reset and then reseating the HDD. When it finally started up, it automatically ran Windows Boot Repair. Why does it do this?

**Edit: It has 2GB of RAM, an Intel Pentium 2.4GhZ Dual-core CPU, and Intel Integrated Graphocs. Windows 7.

***Another note, I WAS intendant on doing something like this to it. I was trying for this result, but I am confused as to how it worked.

Was it helpful?

Solution

I'm guessing that you called this program main.rb. If that's the case, then it's an infinite loop that calls itself, well, infinitely and in a different process (in fact, a different console window) each time. That'll eventually deplete system resources, but it doesn't explain the weird shut-off behavior.

OTHER TIPS

I can see a fork bomb overheating a laptop in 25 minutes. Is the fan broken?

This code wouldn't cause any damage. It was probably just a coincidental failure.

while 1 == 1

creates an infinite loop, causing the program to run forever. No idea why it did anything but hang though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top