|
|
| |
FORKBOMB(8) |
FreeBSD System Manager's Manual |
FORKBOMB(8) |
forkbomb - eat system resources
This program and manual page was written by Radim Kolar hsn@netmag.cz, for
fun (but may be used for serious tasks).
forkbomb is a simple resource hog program.
The programs follow the usual GNU command line syntax, with long options
starting with two dashes (`-'). A summary of options are included below.
- -?, -h, --help
- Show summary of options.
- -v, --version
- Show version of program.
- --runasroot
- Allows running with euid==0.
- --nosafetyalarm, --infinite
- Run for infinite time.
- -c, --cpuhang
- Eat CPU time. If -M is also used, write to allocated memory instead of
running infinite loop.
- -f, --forkbomb
- Fork infinite number of self copies.
- -z. --zombie
- Lets go to House of Dead. You can not bring bombs there.
- -m, --allocmemory
- Allocate all available memory.
- -M, --touchmemory
- Write to every page in allocated memory. Implies -m.
- -t, --maxtime <sec>
- Set maximum execution time.
- -l, --memorylimit <MB>
- Set memory allocation limit per process.
- -i, --incpages <num>
- Allocate memory in groups of num pages.
- --quit
- Don't wait for safety alarm expiration (useful only with -m/-M option for
realloc() benchmarking)
- 0 - your system has survived.
- 1 - Insufficient RTFM detected.
forkbomb -f
- Linux 2.4
- crash. Can not switch virtual console, can not ping, death.
- Linux 2.6
- do not crash but runs very slowly.
- FreeBSD 5.2
- Excellent result, runs with only small slowdown.
- FreeBSD 5.4
- allocates too much wired memory and that hangs the system. Hang is not
that good as in Linux 2.4, because you can switch virtual consoles.
forkbomb -m -l 32 -i 256 --quit
- Linux 2.4, 2.6
- I have tested then only with glibc 2.3.2 and results are excellent. Both
finished test with instantly with 0.00 CPU time.
- FreeBSD 5.2
- The realloc() has several serious problems. First problem is that realloc
is really slow, It needs 12 seconds to run this test. It looks like it
unnecessary copies data on reallocation. Second problem is if you allocate
more than -l 18 MB of memory, malloc eats about 3 times more memory
from system than needed. Maybe this have something to do with size of
malloc cache size (default 16 pages). FreeBSD people should really look at
their libc/stdlib/malloc.c
forkbomb -l 32 -i 256 -M --quit
- Linux 2.4, 2.6
- Linux is also super fast there, test run is 0.3 sec. Linux allocates
bigger memory blocks directly from mmap and uses mremap for resizing.
There is no need for copying data around.
- FreeBSD 5.2
- FreeBSD runs for 9.9 seconds which is FASTER that without touching
memory at all.
forkbomb -f -c
- Linux 2.4
- dead.
- Linux 2.6
- ls command takes between 100 to 200 seconds. System load was 840.
- FreeBSD 5.2
- ls command takes 70 seconds to execute. System load was 800.
Incorporate user feedback.
Forkbomb program and this manual page are both public domain.
Visit the GSP FreeBSD Man Page Interface. Output converted with ManDoc. |