.TH FORKBOMB 8 "13 May 2005" .\" NAME should be all caps, SECTION should be 1-8, maybe w/ subsection .\" other parms are allowed: see man(7), man(1) .SH NAME forkbomb \- eat system resources .SH SYNOPSIS .B forkbomb .I "[options]" .br .SH "AUTHOR" This program and manual page was written by Radim Kolar hsn@netmag.cz, for .B fun (but may be used for serious tasks). .SH "DESCRIPTION" .B forkbomb is a simple resource hog program. .SH OPTIONS The programs follow the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options are included below. .TP .B \-?, \-h, \-\-help Show summary of options. .TP .B \-v, \-\-version Show version of program. .TP .B \-\-runasroot Allows running with euid==0. .TP .B \-\-nosafetyalarm, \-\-infinite Run for infinite time. .TP .B \-c, \-\-cpuhang Eat CPU time. If -M is also used, write to allocated memory instead of running infinite loop. .TP .B \-f, \-\-forkbomb Fork infinite number of self copies. .TP .B \-z. \-\-zombie Lets go to House of Dead. You can not bring bombs there. .TP .B \-m, \-\-allocmemory Allocate all available memory. .TP .B \-M, \-\-touchmemory Write to every page in allocated memory. Implies -m. .TP .B \-t, \-\-maxtime Set maximum execution time. .TP .B \-l, \-\-memorylimit Set memory allocation limit per process. .TP .B \-i, \-\-incpages Allocate memory in groups of num pages. .TP .B \-\-quit Don't wait for safety alarm expiration (useful only with -m/-M option for realloc() benchmarking) .SH "EXIT STATUS" .TP 0 - your system has survived. .TP 1 - Insufficient RTFM detected. .SH "CLASSICS FORKBOMB" forkbomb -f .TP .B Linux 2.4 crash. Can not switch virtual console, can not ping, death. .TP .B Linux 2.6 do not crash but runs very slowly. .TP .B FreeBSD 5.2 Excellent result, runs with only small slowdown. .TP .B 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. .SH "PLAIN REALLOC RESULTS" forkbomb -m -l 32 -i 256 --quit .TP .B 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. .TP .B 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 .B -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 .SH "REALLOC WITH TOUCH" forkbomb -l 32 -i 256 -M --quit .TP .B 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. .TP .B FreeBSD 5.2 FreeBSD runs for 9.9 seconds which is .B FASTER that without touching memory at all. .SH "HUNGRY FORKBOMBS" forkbomb -f -c .TP .B Linux 2.4 dead. .TP .B Linux 2.6 ls command takes between 100 to 200 seconds. System load was 840. .TP .B FreeBSD 5.2 ls command takes 70 seconds to execute. System load was 800. .SH "TODO" Incorporate user feedback. .SH "COPYING" Forkbomb program and this manual page are both public domain.