From owner-freebsd-hackers Wed Dec 4 11:29:48 2002 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 259A537B401 for ; Wed, 4 Dec 2002 11:29:45 -0800 (PST) Received: from swan.mail.pas.earthlink.net (swan.mail.pas.earthlink.net [207.217.120.123]) by mx1.FreeBSD.org (Postfix) with ESMTP id BD90543E88 for ; Wed, 4 Dec 2002 11:29:44 -0800 (PST) (envelope-from tlambert2@mindspring.com) Received: from pool0345.cvx40-bradley.dialup.earthlink.net ([216.244.43.90] helo=mindspring.com) by swan.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 18JfDI-00056a-00; Wed, 04 Dec 2002 11:29:41 -0800 Message-ID: <3DEE50D2.39605F07@mindspring.com> Date: Wed, 04 Dec 2002 11:00:34 -0800 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Mike Silbersack Cc: Stijn Hoop , freebsd-hackers@freebsd.org Subject: Re: [nephtes@openface.ca: [Xmame] Use of usleep() with -sleepidle] References: <20021202151816.GJ83264@pcwin002.win.tue.nl> <20021202114019.R31106-100000@patrocles.silby.com> <20021204113154.GA205@pcwin002.win.tue.nl> <20021204114915.Q41338-100000@patrocles.silby.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Mike Silbersack wrote: > On the other hand, a higher HZ should create a system which runs a bit > smoother for interactive programs. And, as you point out, it is necessary > for good timing in emulators / simulators / dummynet. Higher hardclock rate. It affects dummynet because most of the work it does is at NETISR. Software interrupts run when you splx() back down from a high SPL to one at or below the software interrupt priority level. More hardware interrupts equal more software interrupts, in that case, and so dummynet runs faster. You could achieve the same effect by running multiple dummynet software interrupts. The real problem is peristalsis; you want the dummynet code to run number-of-nodes-along-a-graph-edge number of times per soft interrupt, rather than just once per. So the same effect would be to put the soft interrupt routine in an encapsulation "for" loop with number of nodes on longest edge, plus one. For most dummynet applications, that's basically adding: int j; for( j = 0; j< 4; j++) { ... /* normal dummynet software interrupt code */ } To the dummynet ISR. For emulators and simulators, the problem is badly written code, as I stated previously. Rather than adding a bunch of operations together to get one big operation, the code should use a single big operation. Thus the overhead is amortized, and the timer resolution requirements are significantly reduced. FWIW, my first X11 game I ever wrote, which was similar to the game "LodeRunner", used a select() timeout for the timing loop to ensure smooth game operation. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message