Messages in this thread | | | Date | Thu, 16 Sep 2004 20:10:21 +0200 | From | Henry Margies <> | Subject | Re: Is there a problem in timeval_to_jiffies? |
| |
Hi,
On Thu, 16 Sep 2004 02:54:39 -0700 George Anzinger <george@mvista.com> 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |