cpu usage way too high (?)

Helge Hafting helge.hafting at hist.no
Tue Feb 3 17:18:07 CET 2009


Daniel Spies wrote:
> Hello,
> 
> I must admit that I am not that deep into hardware. I hope someone could 
> explain me why things are like this. For example if I do "apt-get update" I 
> have 100% cpu usage until it's done. Upgrade does the same.
> 
> Recently I tried to play a .ogg file for the first time (also .mp3) and am 
> really confused about the cpu usage again. I tried to play it in vlc, but this 
> doesn't work at all. Playing in alsaplayer is nearly impossible, the song 
> laggs like hell. Only in mplayer (console version) I can listen to the song. 
> But if I do anything else, like moving a window or opending any application, 
> writing in xterm make the sound stop or lag. I can see the cpu usage is at 
> 100% all the time...

I too use mplayer. It needs about 70% of the cpu time, or there will be 
stops.  Now, programs run at priority 0 by default. Some are boosted to 
-5, and some to -10 for some reason.

So run your mplayer at priority -15. It will then be considered much 
more important than other software, and it will get the cpu when it 
wants it. So mplayer will take its 50%-70%, and it is the other stuff 
that has to wait instead. I can play music flawlessly, have the gps plot 
my route on a scrolling map, and edit the contact list. All at the same 
time. Of course, the screen updates is a bit slower this way, but music 
doesn't skip.


apt-get updates a database and calculates dependencies. This is actually 
kind of heavy. And when it isn't busy with that, it is instead busy 
downloading files and writing them out to disk. I believe the sdcard 
interface is a rather cpu-intensive disk, so you get high cpu usage from 
that too.

Helge Hafting



More information about the hardware mailing list