Re: Is there a problem in timeval_to_jiffies?

From: Henry Margies
Date: Thu Sep 16 2004 - 13:22:28 EST


Hi,


On Thu, 16 Sep 2004 02:54:39 -0700
George Anzinger <george@xxxxxxxxxx> wrote:

> Timers are constrained by the standard to NEVER finish early.

I just thought about that again and I think you are wrong.
Maybe your statement is true for one-shot timers, but not for
interval timers.

No interval timer can guarantee, that the time between to
triggers is always greater or equal to the time you programmed
it.

1 occurrence of a 1000ms timer,
10 occurrences of a 100ms timer and
100 occurrences of a 10ms timer should take the same time.

For example:

I want to have an interval timer for each second. Because of
some special reason the time between two triggers became 1.2
seconds.
The question is now, when do you want to have the next timer?

Your approach would trigger the timer in at least one second. But
that is not the behaviour of an interval timer. An interval timer
should trigger in 0.8 seconds because I wanted him to trigger
_every_ second.
If you want to have at least one second between your timers, you
have to use one-shot timers and restart them after each
occurrence.

And in fact, I think that no userspace program can ever take
advantage of your approach, because it can be interrupted
everytime, so there is no guarantee at all, that there will be at
least some fixed time between the very important commands. (for
interval timers)


So, what about adding this rounding value just to it_value to
guarantee that the first occurrence is in it least this time?


Best regards,

Henry

--

Hi! I'm a .signature virus! Copy me into your
~/.signature to help me spread!


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/