polling decreases throughput ~50%
Bill Campbell
freebsd at celestial.com
Tue Aug 2 17:32:46 GMT 2005
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 at 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)
More information about the freebsd-questions
mailing list