[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-multimedia
Subject:    [PATCH] artsd periodic cpu usage check
From:       Stefan Westerfeld <stefan () space ! twc ! de>
Date:       2000-09-04 8:28:52
[Download RAW message or body]

   Hi!

After discussing yet another time the "can't you make artsd play sound
without dropouts" issue on IRC yesterday, I think this patch is about the
only sane way towards a real solution.

As there exist realtime apps (like quake), you don't simply want artsd to
buffer an excessive amount of data, as this increases the latency. Doing
dropout free audio with large buffers is possible for many other apps like
mp3 player, mpg video players and stuff like that. But not for realtime
games or synthesis.

The challenge here is that you need to react to an external event (i.e.
player presses key -> shoots enemy -> enemy dead sound is played) in a
well defined amount of time (i.e. 50 ms), and the only way to ensure that
this works is giving artsd a suitable priority, so that it doesn't remain
unscheduled for more than 50 ms. In fact this solution has been around for
about forever now, it has its own checkbox in KControl, and it uses a nice
suid wrapper called artswrapper. So it is also secure, and works for every
user once KDE is installed correctly.

The only reason why I didn't advocate it too much until right now is that
currently it can bring your box down in some rare cases. As soon as artsd
gets into an infinite loop, no other process gets scheduled any more (as
artsd has highest possible priority).

This patch adresses this issue by periodically (setitimer()) self-checking
the CPU usage of the artsd process (clocks()), and if it is over 90% for
more than 15 seconds, terminating artsd (exit()). I think with this patch
applied, running artsd all the time with realtime rights on some millions
of KDE desktops shouldn't lead to a single freeze.

So I'd like to apply it if there are no objections. Perhaps we can also
make the realtime setting the default after a period of testing.

   Cu... Stefan
-- 
  -* Stefan Westerfeld, stefan@space.twc.de (PGP!), Hamburg/Germany
     KDE Developer, project infos at http://space.twc.de/~stefan/kde *-         
_______________________________________________
Kde-multimedia mailing list
Kde-multimedia@master.kde.org
http://master.kde.org/mailman/listinfo/kde-multimedia

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic