Fw: Priority Increasing

Coleman Kane zombyfork at gmail.com
Mon Feb 28 13:13:50 GMT 2005


On Sun, 27 Feb 2005 20:56:03 -0800, Ashwin Chandra <ashcs at ucla.edu> wrote:
> The forkbomb program I wrote is just one parent that forks 750 or so
>  children that each malloc around 40 MB's of memory and do a mem traversal
>  through it. The children do not fork. I see the overhead of forking could
> be
>  causing this, but shouldn't there be some difference in the load of the
>  system when each forkbomb process is set to the lowest priority? To fork
> 750
>  processes would incur overhead until those processes are created (Which
>  shouldnt take much of real time) and once they are running, if they other
>  processes that have already been created are running "nicely", I don't see
>  why there is so much overhead too.
> 

You are talking about malloc'ing almost 30GB of memory and having 750
readers paw through it to search for something. That is a lot of
swap-backed memory. You are probably experiencing swap thrashing from
all of this memory access/usage. Might I ask why this needs to be done
750 times in parallel? If you are trying to be efficient, try only
forking off readers for each CPU, and waiting until they finish before
you start anew. You also won't be swapping so much information to
disk, which will make your program run alot faster than the method you
are using.

That is, of course, unless you actually do have > 30GB RAM. In that
case, I am way off, but you may want to reduce the number of procs
anyhow.

>  Do you recommend anotoher way to solve this forkbomb problem and keep the
>  system DoS free for others?
>  Ash
> 

Also, this isn't really a forkbomb, as you seem to have a limit
instituted on the number of forks. In a traditional fork-bomb, the
forkers fork themselves, and so on, and so on, ....

--
coleman kane


More information about the freebsd-hackers mailing list