From owner-freebsd-hackers@FreeBSD.ORG Mon Feb 28 13:13:50 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 09A3816A4CE for ; Mon, 28 Feb 2005 13:13:50 +0000 (GMT) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.193]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9871943D55 for ; Mon, 28 Feb 2005 13:13:49 +0000 (GMT) (envelope-from zombyfork@gmail.com) Received: by rproxy.gmail.com with SMTP id a41so860240rng for ; Mon, 28 Feb 2005 05:13:49 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=Zsl3qQJydt52BYAi9GBX7YWTafpLIFELalrvb5J7t/34wPYRdzwQSQ9aMNHJMCTW3XhEpzGZn3FUKilJ3Qck6Qbgb9UvjbfSKbpioFKAbNJYTpbryTQaXe+YmRoGNgdmds2ai9GDMFq19ZlEffQ0RVTqsekUhd4oYNHfxb1ZJ8s= Received: by 10.38.162.1 with SMTP id k1mr57718rne; Mon, 28 Feb 2005 05:13:48 -0800 (PST) Received: by 10.38.22.22 with HTTP; Mon, 28 Feb 2005 05:13:48 -0800 (PST) Message-ID: <346a802205022805137ef19b48@mail.gmail.com> Date: Mon, 28 Feb 2005 08:13:48 -0500 From: Coleman Kane To: Ashwin Chandra In-Reply-To: <000c01c51d51$ce6243b0$abe243a4@ash> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <000c01c51d51$ce6243b0$abe243a4@ash> cc: freebsd-hackers@freebsd.org Subject: Re: Fw: Priority Increasing X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: cokane@cokane.org List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Feb 2005 13:13:50 -0000 On Sun, 27 Feb 2005 20:56:03 -0800, Ashwin Chandra 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