[SDL] Timer accuracy

David Olofson david.olofson at reologica.se
Mon Sep 16 07:38:01 PDT 2002


On Monday 16 September 2002 12:35, Latimerius wrote:
> On Mon, Sep 16, 2002 at 10:20:47AM +0200, David Olofson wrote:
> > However, very few operating systems support timers that can wake up
> > threads, send signals or something like that, with better than 10 ms
> > accuracy. This is because of OS scheduler design, and on some
> > platforms, there isn't much to do about it. The scheduler checks
> > software timers at 100 Hz, and that's it.
>
> Won't rising of HZ in the Linux kernel help timer accuracy?

Well, it *should* increase the resolution of "wake up/signal" style 
timers, but as gettimeofday() normally uses the TSC when available, 
that's still theoretically accurate down to the ns range. (Not sure what 
accuracy the interface actually allows.)

It does *not* make Linux any more of a real time OS, though. You should 
get better average timing accuracy, but you need to take other, much more 
drastic measures to do anything about worst case latency. (Something like 
Linux/lowlatency and/or kpreempt. 2.6 will do it out of the box, it 
seems, but for now, there are various patches for 2.2, 2.4 and 2.5.)


//David Olofson --- Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
|      Multimedia Application Integration Architecture      |
| A Free/Open Source Plugin API for Professional Multimedia |
`----------------------------> http://www.linuxdj.com/maia -'
.- David Olofson -------------------------------------------.
| Audio Hacker - Open Source Advocate - Singer - Songwriter |
`-------------------------------------> http://olofson.net -'




More information about the SDL mailing list