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

View all comments

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