Fork Bomb

December 28, 2011 § Leave a comment

I recently learned about fork bombs and I find myself intrigued by the simplicity behind them.

For those who are unfamiliar with them, I quote the Wikipedia article which provides a nice succinct definition:

A fork bomb works by creating a large number of processes very quickly in order to saturate the available space in the list of processes kept by the computer’s operating system. If the process table becomes saturated, no new programs may start until another process terminates.

Here’s the Python example from the article:

import os
while True:
    os.fork()

Pass those three lines to the Python interpreter and you’ll crash your machine. This isn’t even the shortest example – the Windows batch example is five characters (%0|%0). You can even (apparently) create one in HTML and JS which would allow you to lock a computer (independent of OS) just by visiting a website.

I don’t bring this up to suggest that this is something you should do. Far from it in fact. Rather, I find this simplicity quite elegant (this is what intrigues me). With such a limited input, you can lock up an OS. I’ve tried it (using the Python example above) and the results were interesting. The virtual machine I tried this in slowly sucked up the RAM available to it to the point of locking up. When I say lock up, I mean it in the old ‘Windows 98’ style when nothing was responsive.

Moral of the story: simplicity can still beat complex OS design.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

What’s this?

You are currently reading Fork Bomb at /home/vansmith.

meta

%d bloggers like this: