From owner-freebsd-questions@FreeBSD.ORG Tue Aug 2 17:32:46 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C5A7F16A41F for ; Tue, 2 Aug 2005 17:32:46 +0000 (GMT) (envelope-from bill@celestial.com) Received: from mail.mi.celestial.com (dagney.celestial.com [192.136.111.7]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7D8E343D45 for ; Tue, 2 Aug 2005 17:32:46 +0000 (GMT) (envelope-from bill@celestial.com) Received: from localhost (localhost [127.0.0.1]) by mail.mi.celestial.com (Postfix) with ESMTP id 4170E12857B; Tue, 2 Aug 2005 10:34:22 -0700 (PDT) Received: from mail.mi.celestial.com ([127.0.0.1]) by localhost (alexis.mi.celestial.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 36362-01-5; Tue, 2 Aug 2005 10:34:22 -0700 (PDT) Received: by mail.mi.celestial.com (Postfix, from userid 203) id 0358512856E; Tue, 2 Aug 2005 10:34:21 -0700 (PDT) Date: Tue, 2 Aug 2005 10:34:21 -0700 From: Bill Campbell To: freebsd-questions@freebsd.org Message-ID: <20050802173421.GA34971@alexis.mi.celestial.com> Mail-Followup-To: freebsd-questions@freebsd.org References: <200508021537.26986.victor@vmpbg.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200508021537.26986.victor@vmpbg.com> User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: amavisd-new at mi.celestial.com Subject: Re: polling decreases throughput ~50% X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd@celestial.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2005 17:32:46 -0000 On Tue, Aug 02, 2005, Victor Semionov wrote: >Hello, > >I've noticed something that seems strange to me and I'd like to ask for an >explanation, because I don't think it should be happening. > >I was uploading some large file to my neighbor's windows box. With polling >disabled, the transfer rate was 8 MB/s and CPU usage was 90%. I turned on >polling with sysctl and CPU usage decreased to 50%, which I expected, but >also the transfer rate dropped to 4.5 MB/s, about half. The numbers are >approximate. The interface is a RealTek (rl driver). No background jobs were >running. kern.polling.* all defaults. > >Why is that? I thought polling should decrease CPU usage by avoiding too many >context switches when a hw irq is generated frequently, but it shouldn't make >the transfer slower if there are no other jobs running. I certainly don't claim to be an expert on this subject so take this with a grain of salt. Interrupts were originally created to eliminate the need for polling allowing processes to sleep until an interrupt occurs rather than having the process in a loop testing to see if any input is ready or the device is available for further work. The only place I've seen polling used effectively on *nix systems is on parallel printer ports where cheap hardware or printers wouldn't properly support interrupts. The other place I've seen polling used was with some brain-dead accounting software written in Business BASIC that polled the keyboard for input, and could suck every available cycle -- particularly if the connection to the session terminated abnormally. Bill -- INTERNET: bill@Celestial.COM Bill Campbell; Celestial Software LLC UUCP: camco!bill PO Box 820; 6641 E. Mercer Way FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 URL: http://www.celestial.com/ ``If the future navigation system [for interactive networked services on the NII] looks like something from Microsoft, it will never work.'' (Chairman of Walt Disney Television & Telecommunications)