time measurement

user at domain.invalid user at domain.invalid
Wed May 4 00:31:27 PDT 2005


Thomas E. Spanjaard wrote:
> I don't think you can compare kqueue to select, as kevents can be used
> for arbitrary conditions (with extensibility), and select only wakes at
> reads, writes and exceptions.


	Hi Thomas,

you just confirm what I have written, i.e. that "kevent" can be used to
replace "select" in any situation, because it can do more things, but it
can also do the same things as "select".  Therefore "select" is obsolete
and there is no reason to use it in any new program.

	The only problem with "select" is that many operating systems have
chosen different solutions for replacing "select", so writing a portable
application can be complicated.

	Besides other good features, "kevent" does the right thing, by having
nanosecond resolution for the timeout, like "pselect".  On the other
hand, the Linux replacement for "select" ("epoll_wait") has been ill
conceived so it has only millisecond resolution like "poll" and that
disqualifies it for many applications, in any case for *all*
applications I am interested in.

	Of course, it is possible (and actually true for most current operating
systems) that a bad kernel will implement a much lower resolution for
the timeout even when the API and the hardware allow a high resolution,
but it is stupid to limit the resolution in the standard API.

	Best regards !





More information about the Users mailing list