code for melting computer

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Moderators General, Prelates

>-)
Posts: 512
Joined: Tue Apr 24, 2012 1:10 am UTC

code for melting computer

Postby >-) » Fri Sep 29, 2017 1:36 am UTC

What sort of code could I write in a low level language like C in order to induce maximum energy consumption (and hence melt my computer)?

I remember being shown graphs in my computer architecture class that showed most of the energy expended during computation was from moving bits around, and that the actual operations in the ALU didn't consume that much energy. Based on this information, I was thinking that writing some loops to copy random bits between a few arrays which fit in the L3 cache would heat my computer up the most.

The reason why I think the L3 cache would work better than copying to DRAM is because I've never seen or heard of DRAM needing cooling like the CPU does, so I figured DRAM doesn't consume much energy.

My question: would this actually result in more energy consumption than say, running your average computer stress test? I know the small FFT tests in Prime95 are designed to stress the fpu and the cache, so I wonder how this strategy would compare to that.

Also, does the same logic apply to testing out my GPU? Would it be better there to stress the main memory or the scratchpad memory? I know GPU's don't have much cache to speak of.

User avatar
hotaru
Posts: 1025
Joined: Fri Apr 13, 2007 6:54 pm UTC

Re: code for melting computer

Postby hotaru » Fri Sep 29, 2017 4:57 pm UTC

unless the hardware has a serious flaw, the worst you'll be able to do is waste electricity and maybe shut down the system (the CPU and GPU are more likely to throttle and stay within safe temperature ranges, but if you have especially poor cooling (for example, a laptop packed full of dust), you might be able to get something hot enough that it shuts off to prevent damage.

Code: Select all

factorial product enumFromTo 1
isPrime n 
factorial (1) `mod== 1

User avatar
mosgi
Posts: 46
Joined: Thu Jul 17, 2014 8:19 pm UTC
Location: Somewhere in your past light cone

Re: code for melting computer

Postby mosgi » Fri Sep 29, 2017 7:24 pm UTC

Ooh, I know this one!

Modern computers have very good thermal throttling - ie, when they get hot, they slow way the fuck down to avoid overheating. Old CPUs (10+ years old by now) didn't always have thermal sensors, so you could get them to burn up by running even fairly standard programs without a heatsink - here's an example, from back when Intel had thermal sensors but AMD didn't.

These days you can't really cause that to happen, but I remember seeing a StackOverflow post on how to get your CPU to use as much power as possible. The answer is here - this will burn a ton of power in a very localized area of your processor (the vector unit in each core), so expect it to start throttling pretty quickly if you try running that code.
(they pronouns please)

User avatar
ProphetZarquon
Posts: 9
Joined: Fri Apr 09, 2010 6:28 am UTC

Re: code for melting computer

Postby ProphetZarquon » Wed Nov 01, 2017 9:34 am UTC

>-) wrote:melt my computer

If your goal is to ruin things & not merely waste electricity, throwing the hard disk drive head back & forth while spinning the disk up & then braking repeatedly can ruin a hard drive given enough time (makes a cool noise, too).

As for the motherboard, write up a script to flash the EPROM repeatedly & it'll burn out, leaving a bad BIOS image.

For a final touch, create a looping system restart (as rapid as possible); If allowed to run long enough, the power supply will fail.

I have seen all of these things occur accidentally, so it shouldn't be too hard to make it happen on purpose.

MostlyHarmless
Posts: 150
Joined: Sun Oct 22, 2006 4:29 am UTC

Re: code for melting computer

Postby MostlyHarmless » Wed Nov 01, 2017 9:14 pm UTC

Even on fairly modern computers, it’s possible to cause a lot of damage. For instance, you can brick your battery (or possibly set it on fire) or set your printer on fire. On older machines, I imagine it’s much easier to do terrible things. This stackoverflow thread mentions melting magnetic-core memory and, my personal favorite, “moving the read/write head of a disk drive with the harmonic frequency of the drive cabinet, causing it to walk across a table and fall onto the floor.”

As other commenters have said, modern computers are pretty good at turning off before they get too hot, so any serious damage requires getting around the safety mechanisms first.

User avatar
thoughtfully
Posts: 2244
Joined: Thu Nov 01, 2007 12:25 am UTC
Location: Minneapolis, MN
Contact:

Re: code for melting computer

Postby thoughtfully » Mon Dec 11, 2017 4:18 pm UTC

This will only work on obsolete hardware, but it used to not be that difficult (in theory, at least).
http://www.tldp.org/HOWTO/html_single/X ... WTO/#overd
Image
Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.
-- Antoine de Saint-Exupery


Return to “Coding”

Who is online

Users browsing this forum: No registered users and 13 guests