Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
bogus nice
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
numerodix
l33t
l33t


Joined: 18 Jul 2002
Posts: 743
Location: nl.eu

PostPosted: Sun Mar 30, 2003 1:14 am    Post subject: bogus nice Reply with quote

Sorry for reposting this, I thought it would be more fitting here on second thoughts.

I'm wondering how the process priority settings work exactly. Whenever I emerge a new package I preceed the command with "nice -n 19", seemingly relegating the process to the lowest possible priority. When I then monitor the process (and child processes) in top, I find the nice is in fact 19 and the priority (as shown in top) about 35, as compared to ~15 for most other processes. In ps, most processes have a priority of about 75 while the emerge I executed about 99.

But that doesn't stop the compilation process from locking up my desktop, freezing the mouse pointer and the like.

Trying the opposite setting, I run "nice -n -19 emerge -k mozilla". In top, the nice is -19, priority is 6. In ps, the priority is 64. And now too I get lockups of the desktop.

Next experiment, I run xmms with nice -20, ps shows priority 60, top shows 0. I emerge mozilla with nice 19, for the build process top shows priority 36, ps shows 99. Theoretically, xmms runs at the highest possible priority, emerge and all its child processes at the lowest possible, right? No reason to get interrupts in xmms? Well I still do.

I might also mention all other programs run at default priority (nice), none as low as 19, none as high as -2 even.
What am I missing??

Kernel is 2.4.20-gentoo-r1 if that has anything to do with it.

At this point I was advised that the kernel is bugged on this very issue and I switched to vanilla-sources-2.4.20.

Well I switched to vanilla-sources-2.4.20 now, same problem. Mouse pointer freezes and xmms has interrupts.

# cat /proc/version
Linux version 2.4.20 (root@localhost) (gcc version 3.2.2) #1 SMP Sun Mar 30 00:46:36 CET 2003

# top
Code:
 
  PID USER     PRI  NI  SIZE  RSS SHARE STAT %CPU %MEM   TIME COMMAND
 2444 root      19  19  4044 4044   392 R N  55.6  0.7   0:06 bzip2
 1720 root      -1 -20  9784 9784  4988 S <  12.0  1.8   0:35 xmms
   10 root       9   0     0    0     0 SW    7.8  0.0   0:27 kjournald
 2443 root      19  19   920  920   692 S N   7.8  0.1   0:01 tar
 1698 root       9   0  8056 8056  4808 S     6.9  1.5   0:18 gkrellm2
 1650 root       9   0  276M  20M  4476 S     3.5  4.0   1:14 X
 1748 root       9   0 25744  25M  9800 S     2.1  4.9   0:48 opera
 1675 root       9   0  1892 1892   384 R     0.9  0.3   0:13 esd
 1694 root       9   0 12512  12M  8640 S     0.9  2.4   0:09 gnome-panel
 1706 root       9   0  7332 7328  5992 S     0.5  1.4   0:01 mixer_applet2
 1214 root       9   0  1968 1968  1776 S     0.3  0.3   0:01 ntpd
 1689 root       9   0  5440 5440  3272 S     0.3  1.0   0:07 sawfish


I also tried emerging mozilla in the console, with no X, just to check if it would interfere with typing in another virtual terminal and it does.

EDIT: I have merge the bootsplash package, to enable the framebuffer on your boot screen and the console. That one came with a kernel patch. Could that be affecting this?
Back to top
View user's profile Send private message
avendesora
Veteran
Veteran


Joined: 16 Aug 2002
Posts: 1739
Location: Betelgeuse vicinity

PostPosted: Sun Mar 30, 2003 8:52 am    Post subject: Reply with quote

I don't see anything wrong with your setup.
If you want emerge to run with minimum impact on your perfs. you should
Code:
nice -19 emerge <whatever>
.
That will tell the kernel to only give the process the spare CPU.
The actual priority of a process will change rapidly over time depending on how much CPU it got recently.

Now this isn't 'perfect': sometimes, even with nice -19, the process is going to slow you down (I think heavy I/O might be one).
If your machine has only one CPU, I'd suggest setting SMP to false and getting gentoo-sources or gaming-sources and enable preempt and low-latency features. That should smooth the overall GUI experience.
Back to top
View user's profile Send private message
numerodix
l33t
l33t


Joined: 18 Jul 2002
Posts: 743
Location: nl.eu

PostPosted: Sun Mar 30, 2003 11:43 am    Post subject: Reply with quote

nice -20 is the highest priority, nice 19 is the lowest.
Back to top
View user's profile Send private message
avendesora
Veteran
Veteran


Joined: 16 Aug 2002
Posts: 1739
Location: Betelgeuse vicinity

PostPosted: Sun Mar 30, 2003 12:22 pm    Post subject: Reply with quote

I agree. (Although Niceness and priority are not the same thing.
A process's priority will change during its lifetime depending on how much CPU it has been given. Niceness will never chnage unless someone renices the process).
Back to top
View user's profile Send private message
numerodix
l33t
l33t


Joined: 18 Jul 2002
Posts: 743
Location: nl.eu

PostPosted: Sun Mar 30, 2003 1:25 pm    Post subject: Reply with quote

That's fine, I was just pointing out the obvious as I've seen a lot of confusion about the nice values around these forums.

I also think that as long as the system works as it should, the concept with nice is nicer than the Windows way where [to my knowledge] process priority is set absolutely by either the OS or the user.
Back to top
View user's profile Send private message
carpaski
Retired Dev
Retired Dev


Joined: 04 Aug 2002
Posts: 43
Location: Chicago, IL

PostPosted: Sun Mar 30, 2003 6:58 pm    Post subject: Reply with quote

As mentioned... It's probably IO.

Try something like this for each disk:

hdparm -c1 -d1 -m32 -u1 /dev/hdX

-m32 might need to be set to -m16, depending on your drives.
_________________
Nicholas Jones <carpaski@gentoo.org>
Gentoo Linux Developer
Back to top
View user's profile Send private message
numerodix
l33t
l33t


Joined: 18 Jul 2002
Posts: 743
Location: nl.eu

PostPosted: Sun Mar 30, 2003 7:28 pm    Post subject: Reply with quote

Thanks a bunch!!! My standard test of gunzipping the mozilla sources doesn't torpedo my xmms anymore! :D

I should have figured that out myself however, I did have a hdparm sentence in local.start but it was overwritten in a merge and I forgot to restore it.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum