From owner-freebsd-arch Tue Jan 14 3: 0:39 2003 Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 639B437B401 for ; Tue, 14 Jan 2003 03:00:38 -0800 (PST) Received: from bluejay.mail.pas.earthlink.net (bluejay.mail.pas.earthlink.net [207.217.120.218]) by mx1.FreeBSD.org (Postfix) with ESMTP id E6CAF43F18 for ; Tue, 14 Jan 2003 03:00:37 -0800 (PST) (envelope-from tlambert2@mindspring.com) Received: from pool0016.cvx40-bradley.dialup.earthlink.net ([216.244.42.16] helo=mindspring.com) by bluejay.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 18YOo3-0004tb-00; Tue, 14 Jan 2003 03:00:32 -0800 Message-ID: <3E23ED80.5C5832BC@mindspring.com> Date: Tue, 14 Jan 2003 02:59:12 -0800 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Igor Sysoev Cc: Matthew Dillon , arch@FreeBSD.ORG Subject: Re: getsysfd() patch #1 (Re: Virtual memory question) References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a42230319ac6a1255e509fc33c97650005667c3043c0873f7e350badd9bab72f9c350badd9bab72f9c Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Igor Sysoev wrote: > kqueue already has EVFILT_TIMER in __FreeBSD_version >= 440001 and > __FreeBSD_version >= 500023. Descriptor-based timers would be non-standard > feature and if you use non-standard features then you should use kqueue > instead of poll or select. Most of the blue-sky ideas in this thread are already implemented, like the kevent's that are sent up after registering an interest in file deletion/creation or directory deletion/creation on an fd open to a particular directory, without needing to add yet another interface to support it... > Nevetheless it seems to me that using many kernel timers is not good > thing if you need frequently to set or delete them (i.e. in web-servers). > It's much better to use user-level timer queue and call > kqueue/poll/select with timeout value from the head of this queue. This is actually a bogus argument against it. It turns out that for timers, they work better if they are cancelled before they ever fire, because cancellation is by reference, whereas firing is by traversal. The current implmentation of timers is actually not very good, in general, for a large amount of timers, because the lists in the callout wheel are not sorted, so that a very long list only needs to be traversed until the first non-expired event (instead, each slot in the callout wheel has to have all its entries traversed, to see if they are expired). We were much better off with fixed interval timers, back in BSD 4.2 and 4.3, and the change to a callout wheel is a recent thing (there are actually some idiots who believe they have invented the idea of fixed interval timers to get around this problem, when there's actually over 22 years of prior art). In any case, it's much more bogus to argue against timers that never fire, than it is to argue against timers that do fire -- the 2MSL timers used everywhere in the TCP stack are actually timers that, in the common case, never actually fire. If you want to argue against non-firing timers, you'd need to revert the change to the TCP stack that moved it to the callout wheel based timers, back in the mid/late 1990's. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message