From owner-freebsd-hackers@FreeBSD.ORG Sat Jun 11 00:16:07 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 1BD2616A425 for ; Sat, 11 Jun 2005 00:16:07 +0000 (GMT) (envelope-from fullermd@over-yonder.net) Received: from mortis.over-yonder.net (adsl-222-102-125.jan.bellsouth.net [68.222.102.125]) by mx1.FreeBSD.org (Postfix) with ESMTP id C029143D1D for ; Sat, 11 Jun 2005 00:16:06 +0000 (GMT) (envelope-from fullermd@over-yonder.net) Received: by mortis.over-yonder.net (Postfix, from userid 100) id 2FD7020F6C; Fri, 10 Jun 2005 19:16:05 -0500 (CDT) Date: Fri, 10 Jun 2005 19:16:04 -0500 From: "Matthew D. Fuller" To: Mike Hunter Message-ID: <20050611001604.GB93862@over-yonder.net> References: <20050610224415.GB11336@malcolm.berkeley.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050610224415.GB11336@malcolm.berkeley.edu> X-Editor: vi X-OS: FreeBSD User-Agent: Mutt/1.5.9i-fullermd.2 Cc: freebsd-hackers@freebsd.org Subject: Re: Slowing down an old program to run on a fast CPU? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Jun 2005 00:16:07 -0000 On Fri, Jun 10, 2005 at 03:44:15PM -0700 I heard the voice of Mike Hunter, and lo! it spake thus: > > Is there a general-purpose approach to this kind of problem in the > FBSD world? I can see myself writing a C program called `slow` that > would take argv[1] as the factor ( > 1) by which argv[2] should be > slowed down by. It'd be tough. One way might be a wrapper program that SIGSTOP'd and SIGCONT'd the program with some pauses, but that would be incredibly nasty and probably not too pretty. A better way could would be to wrap the program with a library implementing sleep() and friends differently, so they pause for N times as long. But even that doesn't help when the programs don't slow themselves down. I guess the only general solution would be an API into the scheduler saying "Don't give this program more than N% of the CPU", but I'm pretty sure we don't have one. It'd be neat, though... /usr/bin/too-nice-for-its-own-good 8-} -- Matthew Fuller (MF4839) | fullermd@over-yonder.net Systems/Network Administrator | http://www.over-yonder.net/~fullermd/ On the Internet, nobody can hear you scream.