Subject: Re: setitimer discrepancy between Netbsd 1.4.1 and 1.5.1 or later
To: , <tech-kern@netbsd.org>
From: Stuart Brooks <stuartb@cat.co.za>
List: tech-kern
Date: 10/08/2004 15:48:49
As a follow on, having looked at "The Design and Impl of 4.4BS OS" I can
understand how the first timeout could be 20ms, as the the process would
only be woken up at X (below) which is 1 and a bit ticks further on. However
I would have thought that the kernel timer would have continued ticking at
regular intervals, resulting in a second timeout being handled at Y 10ms
later.

This is probably an oversimplification, but its the best I can come up with.

                                      Handled #1        Handled #2
|<----10ms---------->|                    X                    Y
|--------------------|--------------------|--------------------|
   |....................^....................^
  Timer            Timeout #1            Timeout #2
  started


----- Original Message -----
From: "Stuart Brooks" <stuartb@cat.co.za>
To: <port-i386@NetBSD.org>; <tech-kern@netbsd.org>
Sent: Friday, October 08, 2004 3:26 PM
Subject: setitimer discrepancy between Netbsd 1.4.1 and 1.5.1 or later


> On my i386 (Celeron 1.2G) machine I have noticed a discrepancy in the
> interrupts generated by setitimer between NetBSD 1.4.1 (which does what I
> expect) and later versions. I understand the granularity of the clock tick
> is 10ms but NetBSD 1.5.1 refuses to timeout at less than 20ms, although it
> will happily timeout at 20,30,40,50ms etc.
>
> Here is the printout from a sample program (which I have attached) :
>
> Netbsd 1.4.1 (as expected):
> Delay set to 10000us
> - 3907us
> - 9964us
> - 10061us
> - 9962us
> - 9974us
> - 10026us
> - 9975us
> - 10031us
>
> Netbsd 1.5.1 (incorrect):
> Delay set to 10000us
> - 15248us
> - 20011us
> - 19991us
> - 20072us
> - 19914us
> - 19991us
> - 20001us
> - 20006us
>
> I thought that it might be because I was just missing a clock tick because
> the 10ms timer is "on the edge" but I get exactly the same results with a
> 1ms timer (20ms on 1.5.1 and 10ms on 1.4.1).
>
> Is this the correct operation? And if so then it effectively means that it
> is impossible to have more than 50 timed interrupts a second.
> Any help would be appreciated,
>
>  Stuart
>