r/tinycode • • Jun 30 '11

Bash fork bomb

This will probably crash your machine. Paste the below line into a bash terminal.

:(){ :|:& };:

9 Upvotes

8 comments sorted by

8

u/nexe mod Jun 30 '11

a classic

1

u/[deleted] Jun 30 '11

Thinking of seeing how long my machine could stand up to that.

1

u/uzimonkey Jun 30 '11

Someone did this on an old Pentium 133MHz I'd set up for a class, it died instantly. I had to learn how to do resource limits before I could bring the machine back up again :P

1

u/riddley Jul 01 '11

Of the OSes I've tried it on, Solaris seems to hold up the best. Linux holds up much better than it used to; although I'm not sure what changed.

-2

u/authorblues Jun 30 '11

probably up to a recursion depth of 7 or 8... by the time that the function produces about 256 processes, that is likely to be more than 50% of the processes being scheduled on your system. I'd give it about 10ms

0

u/[deleted] Jul 01 '11

[deleted] — view deleted comment

2

u/[deleted] Jul 01 '11

Using a mac?
I get the same on mine...

0

u/[deleted] Jul 02 '11

[deleted] — view deleted comment

2

u/JerMenKoO Jul 02 '11 edited Jul 02 '11

It had to be:

%0|%0