On Fri, 30 Dec 2005 17:04:24 +0100 Florian Schmidt <[EMAIL PROTECTED]> wrote:
> I also stumbled across some problems with sleep() and especially waking > up when the sleep time has expired in the course of writing my > rt_watchdog program. Sometimes the high prio SCHED_FIFO thread wasn't > woken up as long as a lower SCHED_FIFO prio thread hugged the cpu even > when the sleep time of the high prio thread was long expired.. Ingo told > me back then that there's extra kernel threads for the timing subsystem > which need to be setup to high prios too for this to work correctly. > Haven't really investigated further into this. > > I need to write another small test app that uses sleep based timing and > a high prio, too, to drive ughsynth. Will report what results i get. Ok, as Ingo has told me before (and which i just remembered again today): To make sure threads actually do get woken up after their sleep() time elapses one needs to make the softirq-timer/0 thread (only in -rt) systems high priority, too (higher than jack). I actually implemented a small sleep() based midi note generator (similar to the rtc based one) and the results i get are a little worse than with the rtc based timer, but not by thaaat much: diff: 6047 diff: 5999 diff: 5999 adjusted midi event [frame offset >nframes] - handed to next period diff: 5999 diff: 6048 diff: 5998 diff: 6000 diff: 6047 diff: 5999 diff: 5999 diff: 5999 diff: 6047 diff: 5999 diff: 6000 diff: 5999 diff: 6047 That's in the 1-2% jitter range which is still fine for me. Rosegarden in 2.6.14 vanilla and with the adjusted softirq-timer/0 kernel thread works a lot better than w/o the adjustment (naturally) when using the system timer as timing source. So all -rt users beware, make your softirq-timer/0 thread high prio, too :) Benefits seq24, too. Regards, Flo P.S.: if you want to make your own experiments, here's the updated tarball with the sleep() and rtc based test note generators (they only produce note-on events though): http://affenbande.org/~tapas/midi_timer-0.tgz -- Palimm Palimm! http://tapas.affenbande.org