From owner-freebsd-hackers@FreeBSD.ORG Sun Aug 3 13:54:11 2003 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 1D29737B401 for ; Sun, 3 Aug 2003 13:54:11 -0700 (PDT) Received: from priv-edtnes09-hme0.telusplanet.net (outbound02.telus.net [199.185.220.221]) by mx1.FreeBSD.org (Postfix) with ESMTP id 43BD043F93 for ; Sun, 3 Aug 2003 13:54:10 -0700 (PDT) (envelope-from sh@bel.bc.ca) Received: from antalus ([154.5.106.237]) by priv-edtnes09-hme0.telusplanet.netSMTP <20030803205409.HKZJ1600.priv-edtnes09-hme0.telusplanet.net@antalus> for ; Sun, 3 Aug 2003 14:54:09 -0600 Message-ID: <000501c35a01$6383e040$0300000a@antalus> From: "Sean Hamilton" To: Date: Sun, 3 Aug 2003 13:54:10 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Subject: Tuning HZ for semi-realtime applications X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Aug 2003 20:54:11 -0000 Greetings, I have an application which has some task it must execute at some interval (approximately 1000 times per second.) This application calls select(2) in a loop, and uses its timeout parameter to try to keep the timing consistent. At the end of a cycle, it sends out a large amount of network traffic. During the select loop, it expects to receive replies to all this traffic. Should I set HZ to 1000 (the frequency of my application) or should I set it to a much higher value? The CPU is running at around 2 GHz, and I set it as high as 50,000 with no problems. However, the granularity of my timeout appears to be restricted to 1/1000th of a second. I would like to use poll(2) instead of select, but it appears to take its timeout parameter in milliseconds, which aren't precise enough to keep my timing reasonable, especially if I ever need to increase my frequency. Another option would be calling poll/select with no timeout, in a loop. However, this seems like a waste of CPU time. Also, as I am doing large amounts of network traffic, which NIC (preferably gigabit) should I be using, to cause the least interference with my timing? I do not require realtime performance. I am just looking to have this run as smoothly as possible. sh