Date: Tue, 14 Jan 2003 02:59:12 -0800 From: Terry Lambert <tlambert2@mindspring.com> To: Igor Sysoev <is@rambler-co.ru> Cc: Matthew Dillon <dillon@apollo.backplane.com>, arch@FreeBSD.ORG Subject: Re: getsysfd() patch #1 (Re: Virtual memory question) Message-ID: <3E23ED80.5C5832BC@mindspring.com> References: <Pine.BSF.4.21.0301141233180.26727-100000@is>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3E23ED80.5C5832BC>