Subject: select timeout question
To: NetBSD TechKern <tech-kern@netbsd.org>
From: Matthew Fincham <matthewf@cat.co.za>
List: tech-kern
Date: 09/22/2004 19:45:27
Hi

Firstly, I hope the table below is readable! (you will need a fixed width
font)

I am trying to understand the time taken for the select system call to
return, given a timeout value. With the select watching no descriptors on an
idle system the results are as follows:

 ---------------------------------------------------- 
|Timeout passed  |           Actual timeout (ms)     |
|to select (ms)  | NetBSD 1.5, 1.6, 2.0 | NetBSD 1.4 |
|----------------|----------------------|------------|
|     10         |          20          |    10      |
|     11         |          30          |    10      |
|     20         |          30          |    20      |
|     21         |          40          |    20      |
|     30         |          40          |    30      |
|     31         |          50          |    30      |
     ...

It seems the 1.4 version rounds down, while the 1.5 and up version rounds up
(but two levels). Can anyone shed some light on this, and if there is a way
to improve the resolution of the timeouts (asking for a 21ms timeout and
getting a 40ms timeout is not great).

Many thanks.
Matthew Fincham