Troll! Crash Friends PC

Pages: 12
closed account (EwCjE3v7)
Today i was Just looking through my book and than i just wanted to try something from the book and when i tried it my pc crashed...Now dont say my pc is crap

SPECS:
Proc: AMD phenom II 1.8 GHz Quad Core
Ram: 4 gig
hardrives : one 500 gb and one 320 gb
graphics card: nvidia gt 430

and i have 5 fans cooling it with blue leds

Here is the code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>

using namespace std;

int main()
{
    // WRONG: u can never be less than 0; the condition will always succeed
    //THIS WILL CRASH!!!!!!
    for (unsigned u = 10; u >= 0; --u)
    std::cout << u << std::endl;


    return 0;
}
That should cause your program to hang... but not your entire PC to crash.
closed account (EwCjE3v7)
No I just could click on anything...so I just hard reboot
closed account (o1vk4iN6)
Cooling wouldn't really be the issue, you probably have bad memory that you don't normally use til this program expended all of it. Only people that jump to the conclusion a computer is shitty because something didn't work are those uneducated with the ways of the force hardware. So many things can go wrong with the manufacturing of hardware, something as small as a hair can cause a circuit to malfunction. It's not uncommon to get brand spanking new defective hardware.
closed account (EwCjE3v7)
Thanks xerzi...

Well my i know it's not about the cooling.its just that I wanted my pc cool....
Cooling wouldn't really be the issue, you probably have bad memory that you don't normally use til this program expended all of it.

I would expect this program to use very little memory. It's just an endless loop with a couple of function calls.
closed account (o1vk4iN6)
cout is essentially a system call though, what the kernel does with the output and how much of it it stores is implementation defined if I had to guess.
closed account (N36fSL3A)
What about this?

1
2
std::cout << "'bout to crash your sh*t";
long crasher[10000000000][10000000000];


Or even better:

1
2
3
4
5
6
7
8
std::cout << "'bout to crash your sh*t";

for(int t = 0; t < t + 1; t++)
{
    long crasher[10000000000][10000000000];
}

// Just incase this dude gots a super pc 
Last edited on by Fredbill30
pfft.

1
2
while(1)
    fork();
1
2
3
4
std::istream ifile("/dev/random");
std::ostream ofile("/dev/mem");
while (true)
    ofile.put(ifile.get());
Last edited on
closed account (EwCjE3v7)
Yea those work to but what i dont get is why did my pc hang when i did it....like its not that old and i am running ubuntu
closed account (1yR4jE8b)
Disch's example is an infinite loop that keeps spawning an exact copy of itself, each copy creates more copies of itself in an infinite loop until you run out of memory.

http://en.wikipedia.org/wiki/Fork_bomb

Chrisname's example takes random data from the kernel RNG and writes it directly to memory, effectively overwriting programs in memory and corrupting the system.
Last edited on
closed account (N36fSL3A)
What about me? D;
Fredbill, those just release exceptions and create nothing. You can't allocate that much memory- it just creates an exception when you do and sets the array to 0.
closed account (N36fSL3A)
Oh. So can I just keep allocating memory?

1
2
3
4
5
6
long *pointer;

while(1)
{
    pointer = new long;
}
closed account (1yR4jE8b)
Yes. But depending on the OS, it might not hang the system.

Linux will either kill the process, or the process will simply silently fail to allocate memory and continue in the loop while nothing happens to the rest of the system, or the OOM in the kernel may start killing random things. This all depends on how that system's kernel is configured.

The last time I tried it on Windows, the kernel will just kill it when it uses too much memory. I don't know if there is a way to change this, I've never bothered to look.

Last time I tried that on a Mac, OS X simply continued to expand the swap file until the entire system was unusable. I don't know if this can be configured, or has changed in recent version of OS X.
closed account (N36fSL3A)
It takes way to long though (pun intended). I need a quicker way on crashing the PC.
i have 5 fans cooling it
Pfft. That's nothing.
with blue leds
Oh, with blue LEDs. Well, that changes things, then. As we all know, blue light makes things colder.
closed account (EwCjE3v7)
@helios

Lol...I just wanted to show of my pc.., :)
closed account (N36fSL3A)
Nothing to be proud about if you have a 1.8 ghz processor. No offense.
Pages: 12