Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Aug 2005 10:34:21 -0700
From:      Bill Campbell <freebsd@celestial.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: polling decreases throughput ~50%
Message-ID:  <20050802173421.GA34971@alexis.mi.celestial.com>
In-Reply-To: <200508021537.26986.victor@vmpbg.com>
References:  <200508021537.26986.victor@vmpbg.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050802173421.GA34971>