[SDL] Timer accuracy

David Olofson david.olofson at reologica.se
Mon Sep 16 07:50:59 PDT 2002

On Monday 16 September 2002 16:10, Matthew Miller wrote:
> On Mon, Sep 16, 2002 at 10:20:47AM +0200, David Olofson wrote:
> > 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.
> For what it's worth, this is going to change to 1000 (or maybe 1024 --
> I forget) in the next release of the Linux kernel.

Is this final? (Been out of the loop for a while...)

It's about time, considering any current x86 chip has to be faster than 
the Alphas that ran 1024 Hz back in the Pentium days, even when 
considering the generally poor interrupt handling of the x86 arch...

> > That said, Win32 has "multimedia timers" that support 1000 Hz
> > scheduling, and Linux on virtually any PC or workstation (regardless
> > of CPU) has the RTC, which can be programmed to generate IRQs up to
> > 8192 Hz.
> In order to access this, your program has to be run as root, though,
> right?

Yeah... until I, or some one else, gets fed up with it, and implements a 
multimedia timer API with a system deamon to configure the RTC.

BTW, the 64 Hz limit is nothing but ridiculous, considering that just 
about any sound card can be set up to generate well above 1000 IRQs per 
second. It should have been changed to 1024 Hz long ago, IMHO.

Either way, giving non-root applications access to >64 Hz doesn't really 
solve anything, as the RTC would still be a non-sharable device. You 
can't really view it as a multimedia timer, as only one application at a 
time can use it for that purpose.

So, the multimedia timer API that would solve the root issue, would be 
needed anyway.

//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