# [SOLVED] amarok gets "lags" when I use other programs

## Gabriel_Blake

That's my problem. When i use emerge, or another cpu consuming operation, amarok starts to lag (stops playing and starts again every few seconds). I guess that because there's not enough cpu/memory left for amarok when emerge is running. Is there any way to ser amarok to "real time priority" ??Last edited by Gabriel_Blake on Tue Oct 16, 2007 6:39 pm; edited 1 time in total

----------

## Mantaar

 *Gabriel_Blake wrote:*   

> Is there any way to ser amarok to "real time priority" ??

 

<cynical_but_not_offending>Uh, please get rid of the Windowsthink...  :Wink:  </cynical_but_not_offending>

In *NIX-world, we call that 'to nice a process' since its CPU-priority is determined by its nice value. On a single user machine however, you generally don't need that. I've been using Linux exclusively for some two and a half years now and never really needed it.

Besides, I don't think that renicing such a bloаted hog will actually increase its performance. Could you please first check whether or not you're using the ARTS-sound demon? If so, try disabling it altogether. (KDE-users: help me! How to do this? I think it was somewhere in KDE's 'control center'... something like a checkbox with 'use sound server'... )

You'll have to choose something different for 'output' in Amarok as well.

----------

## Gabriel_Blake

I'm not using the demon you've mentioned. I'm not even using KDE  :Smile:  I'm on fluxbox. The output plugin for amarok is alsa (installed as kernel module). 

Hmmm... now I've realized that the bigger the compiled package, the bigger the lag :/

----------

## Mantaar

If you don't insist on using amarok, try mpd and gmpc. They follow a client/server model: your music keeps on playing even when you restart X (and even when you restart your computer) and you can control that thing from console via mpc.

If you want to continue using amarok you may try to increase your alsa buffer size. Consult alsa docs or somebody else on how to do that, I have no idea, I just know I did something like that once. Long. Ago.

----------

## wyvern5

Also, set your HZ in the kernel to be 1000 instead of the default 100. 1000 is better for desktops. How fast is your CPU?

----------

## bunder

 *Gabriel_Blake wrote:*   

> I guess that because there's not enough cpu/memory left for amarok when emerge is running.

 

I know this obviously won't help for other apps, but have you tried setting PORTAGE_NICENESS?

----------

## Gabriel_Blake

I've rebuild the kernel with 1000Hz (My procesor is Croe 2 Duo 4300). But it didn't help 

I'll give mpd and gmpc a try as you said Mantaar.

----------

## KRF

Give PORTAGE_NICENESS a try. Also check this: http://bugs.kde.org/show_bug.cgi?id=136576

----------

## wyvern5

Your CPU is plenty fast enough to have completely smooth audio playback. What is your motherboard?

----------

## Gabriel_Blake

Gigabyte 965P-S3. Guess it's not a hardware problem. I think I'll just find a different mp3 player. Amarok takes too long to start and I prefer to hae something "lightweight"  :Smile: 

Can't emerge mpd but thats in a different thread.

----------

## wyvern5

I presume you're using the xine output plugin?

----------

## Gabriel_Blake

Yes  :Smile: 

----------

## argent2

@Gabriel

I've had a similar problem with audio, and although I don't have a solution, I may be able to make a suggestion. Are you using the ext3 filesystem and are the pauses every 5 seconds or so?

----------

## eean

Try the newest kernel or the -ck kernel.

Now if your system is actually running out of memory and working out of swap, there is probably nothing that can be done for it, your system is going to pretty much grind to a halt when that happens. You can set portage to use only -j1 instead of -j3 or something (its in your /etc/make.conf),  having multiple compiles running uses *a lot* of memory.

However with the powerful computers we have these days theres no reason for skip when your CPU is just busy. Older kernels (before the most recent) had a scheduler designed with servers in mind which sometimes caused sound skips. The new scheduler should help somewhat.

----------

## wyvern5

Try compiling xine-lib with mad support.

----------

## Gabriel_Blake

Compiling xine-lib with mad support didn't give much. I have 2x512MB of RAM in dual chanel, and 5GB of swap so I don't think there's a problem with memory. i'll look for a different player. 

Thanks for trying to help me. I appreciate that  :Smile: 

----------

## martin.k

I think you should try adding PORTAGE_NICENESS option to your /etc/make.conf - as mentioned before. Give it some positive value e.g. PORTAGE_NICENESS="10" - it will slow down a little compilation times on your machine, but it may help with the sound skipping.

And if it's no good for you I think you should try some newer linux kernel sources (2.6.23 or so) with newest CFS scheduler patch from Ingo Molnar http://people.redhat.com/mingo/cfs-scheduler/. I does fine job and it's getting better with every release.

And if you don't mind using some 2.6.22 kernel you should give a try -ck patch from Con Kolivas - http://members.optusnet.com.au/ckolivas/kernel/ or some *-sources which include it.

For a long time Con's patchset was the no.1. on the desktop interactivity (e.g.music) playground. But -ck is no more, alas.

----------

## Grayman

Hi

just wondering if you have dma turned on - your box is waaaay more powerful than mine (I have a 2.6 P4 with 768 megs ram) and I can run amarok very comfortably.

hdparm /devhda (where dev/hda is your hard drive - yup I have an ata drive here too... sob )

you would need to be root to run hdparm (and obviously to have it installed)

Grayman

----------

## toralf

 *wyvern5 wrote:*   

> Try compiling xine-lib with mad support.

 Solved a similar issue for me  :Smile: 

----------

## iom

i believe this is not a cpu-related problem but rather heavy disk usage. if you watch carefully, the problem you described should occur exactly when a package is being extracted to /var/tmp/portage/.... Try emerging firefox for instance and watch carefully when amarok stops performing well.

how to solve this i don't really know. maybe you don't have proper support in kernel for your hard disk controller. maybe hdparm could help.

----------

## Gabriel_Blake

I've recently realized that the lag is in the entire fluxbox.... Firefox is lagging too. Even the mouse cursor has lags.  :Sad:  I think this topic should be in a different part of the forum.

----------

## Grayman

Hello

did you check that dma is functional on your drive ? a jerky mouse when the system is under load sounds like a dma-dysfunctional system to me.

Grayman

----------

## Archimedesmp

Hi, if you post this somewhere else please post a link here as some kind of follow up  :Wink: 

I had no lag with Amarok with Kernel 2.6.20-forgot-rc and now I'm using 2.6.23-rc8-mm2 and believe me: Playing drums with that lag while portage compiles something is no fun at all  :Sad: 

But I believe it is something with the kernel config as I didn't have any problems with my old kernel.

Oh, yeah, as this might be of interest (esp. if the kernel config is not optimal): I run an Asus A8Jp Notebook with C2D T7200@2x 2Ghz (4Mb) on an ICH7 Chipset and 1Gb of RAM... Disk is some SATA; hdparm -tT gives me 30 to 40 MB/sec, sometime only 20 (right after 40...)

I changed my config and don't have any problems recently, but I didn't listen much music while working.

The major thing I altered was disabling the "Preemt the Big Kernel Lock" because a friend told me that was only needed on old machines (well, I don't know if he is right with that, I'm just trying) and changed from "Preemptible Kernel (Low-Latency Desktop)" to "Voluntary Kernel Preemption (Desktop)" because I didn't want the kernel to preempt all the time (maybe this does the trick) - though I used both setting (PREEMPT and Low Latency) with the non-laggy 2.6.20 *confused*...

Neither compiling nor untaring current eclipse (138Mb) caused any lag with this config:

```
arcbook test # time tar xf eclipse-SDK-3.3-linux-gtk-x86_64.tar.gz 

real    0m42.863s

user    0m3.860s

sys     0m1.960s
```

archi (on Gome 2.18.0)

//edit

I'm to slow, Grayman posted while I was still writing ^^

How can you find out wether dma on sata is turned on?

(I'm asking as I have the same problem)

----------

## Gabriel_Blake

Well... I have a SATA II disk. Ive made read checks with hdparm ant the results were:

Cached disk reads      2357 MB/sec

Buffered disk reads     3.78 MB/sec

So is that good or bad ??  :Razz: 

PS I thought dma is only an issue with ata disks.

----------

## toralf

Try compiling xine-lib with mad support, if not already done.

----------

## Gabriel_Blake

done that... didn't work :/ btw.... as i said the entire system is lagging, so it's not a problem related directly to amarok. 

Any ideas ?? PLEASE ??

----------

## Gabriel_Blake

bump

----------

## Grayman

hi

have a look at this 

https://forums.gentoo.org/viewtopic-t-597929-highlight-sata.html?sid=80d24bb5b09a19332a7171534d18a86e

 or try a search in the kernel section for "sata"

(it might be easier to search Google in the gentoo forums:

"sata kernel" site:https://forums.gentoo.org

as there seems to be a bug in the forums...

I don't have sata - mores the pity... - so cannot help much more

Grayman

----------

## Gabriel_Blake

ok.... so... I've found the solution but I've failed to use it :/ 

The thing that has to be done is to recompile the kernel without the devices>ATA>"generic...IDE....." option in the menuconfig. I'd realized that something was wrong because my SATA drive was marked as hda1 all the time (not sda1).

So I've recompiled the kernel and made a new grub.conf file and reinstalled grub. 

The problem now is that although the kernel boots fine and there's no "kernel panic", at one point I get en error about a damaged file system (at the point "Checking root filesystem") and it's looking for /dev/hda2 which should be /dev/sda2.  I'm almost sure it's the problem of hda1 being brutally changed to sda1 and the system goes crazy.

I'm on Window$ now  :Sad:  Any help PLEASE ??

PS Please move this topic to "Kernel and Hardware"

----------

## bunder

 *Gabriel_Blake wrote:*   

> The problem now is that although the kernel boots fine and there's no "kernel panic", at one point I get en error about a damaged file system (at the point "Checking root filesystem") and it's looking for /dev/hda2 which should be /dev/sda2.  I'm almost sure it's the problem of hda1 being brutally changed to sda1 and the system goes crazy.
> 
> PS Please move this topic to "Kernel and Hardware"

 

put in the livecd.  boot it.  mount up and edit the fstab... you should then change all the hd's to sd's and you should be good.  but make sure you edit the right fstab, or nothing will happen.   :Wink: 

cheers

Moved from Multimedia to Kernel & Hardware.   :Cool: 

----------

## Gabriel_Blake

I've fixed it but it wasn't a problem with fstab, because i thought about it earlier  :Wink: 

The problem was with my bios. It was set to show sata discs as ide. I've changed that and a few sata drivers in the kernel.... it worked  :Smile: 

but there's a new problem... the system loaded to the login screen (slim) and hung there... no response :/ but i think i have a solution for that... i'll try to edit all the configfiles i can find and change /dev/hda2 to /dev/sda2. I'll do it a sec... If it does't work I'll be posting here really soon  :Razz: 

--EDIT--

I've accidentally turned off USB HID in the kernel... now I'm back on Gentoo... I'll check if ther's any difference on the "sata controlled" system.

----------

