| View previous topic :: View next topic |
| Author |
Message |
correctclick n00b


Joined: 18 Jul 2002 Posts: 71
|
Posted: Sun Dec 08, 2002 9:52 pm Post subject: Automatic nice values? |
|
|
Hi. Frequently, I'm compiling something while I use openoffice and my mouse begins to jump, keypresses come in spurts, etc. I found that by nice'ing openoffice (soffice-bin actually) to 20, everything gets much more responsive and there really is no difference compared to when I'm not compiling anything. My question is, is there a way for me to tell linux to always run a certain program with a certain nice value? This would save me from having to renice all the time.
I suppose a script could do it by looking for the pid in ps -A and using that to renice, but this seems like the sort of thing linux would be able to do by itself and I'd rather not take the time if there's a better way.
Any help would be appreciated, thanks. |
|
| Back to top |
|
 |
simulacrum Tux's lil' helper

Joined: 30 Nov 2002 Posts: 128 Location: St Paul, MN
|
Posted: Mon Dec 09, 2002 4:30 am Post subject: |
|
|
| I've thought about this one myself. Although I haven't done it yet, I've considered aliasing emerge to "nice -n20 emerge" in my .bashrc for root. Seems a bit clunky but would work. Anyone with a better idea? |
|
| Back to top |
|
 |
DArtagnan l33t


Joined: 30 Apr 2002 Posts: 942 Location: Israel, Jerusalem
|
Posted: Mon Dec 09, 2002 6:27 am Post subject: |
|
|
| simulacrum wrote: | | I've thought about this one myself. Although I haven't done it yet, I've considered aliasing emerge to "nice -n20 emerge" in my .bashrc for root. Seems a bit clunky but would work. Anyone with a better idea? |
I tried what u've said ( nice -n20 emerge ) and I got the help of emerge  _________________ All for one and one for All
--
MACPRO machine... |
|
| Back to top |
|
 |
simulacrum Tux's lil' helper

Joined: 30 Nov 2002 Posts: 128 Location: St Paul, MN
|
Posted: Mon Dec 09, 2002 6:36 am Post subject: |
|
|
| I'm saying to alias emerge to "nice -n20 emerge" so that when you emerge a package, it's nice'd down to +20. |
|
| Back to top |
|
 |
DArtagnan l33t


Joined: 30 Apr 2002 Posts: 942 Location: Israel, Jerusalem
|
Posted: Mon Dec 09, 2002 6:38 am Post subject: |
|
|
| simulacrum wrote: | | I'm saying to alias emerge to "nice -n20 emerge" so that when you emerge a package, it's nice'd down to +20. |
Oh, ALIAS now I got it , thanks. _________________ All for one and one for All
--
MACPRO machine... |
|
| Back to top |
|
 |
zhenlin Veteran

Joined: 09 Nov 2002 Posts: 1361
|
Posted: Mon Dec 09, 2002 7:00 am Post subject: |
|
|
| I thought nice -20 is most important, and nice 20 is background task? |
|
| Back to top |
|
 |
DArtagnan l33t


Joined: 30 Apr 2002 Posts: 942 Location: Israel, Jerusalem
|
Posted: Mon Dec 09, 2002 7:02 am Post subject: |
|
|
| zhenlin wrote: | | I thought nice -20 is most important, and nice 20 is background task? |
Man page says:
| Code: |
NICE(1) User Commands NICE(1)
NAME
nice - run a program with modified scheduling priority
SYNOPSIS
nice [OPTION] [COMMAND [ARG]...]
DESCRIPTION
Run COMMAND with an adjusted scheduling priority. With no COMMAND, print the current scheduling priority. ADJUST is 10
by default. Range goes from -20 (highest priority) to 19 (lowest).
-n, --adjustment=ADJUST
increment priority by ADJUST first
|
_________________ All for one and one for All
--
MACPRO machine... |
|
| Back to top |
|
 |
aardvark Guru


Joined: 30 Jun 2002 Posts: 576
|
Posted: Mon Dec 09, 2002 10:33 am Post subject: |
|
|
| zhenlin wrote: | | I thought nice -20 is most important, and nice 20 is background task? |
the higher the niceness, the nicer it is for you when you wanna do other things ! |
|
| Back to top |
|
 |
correctclick n00b


Joined: 18 Jul 2002 Posts: 71
|
Posted: Mon Dec 09, 2002 12:14 pm Post subject: |
|
|
Thanks everyone for your help, I may do that. Just one other question:
Will always giving emerge a low priority slow things down when I'm not using the computer? Obviously, when I'm not using it, I'd like it to go as fast as possible.
Thanks everyone for you help. |
|
| Back to top |
|
 |
aardvark Guru


Joined: 30 Jun 2002 Posts: 576
|
Posted: Mon Dec 09, 2002 12:46 pm Post subject: |
|
|
| correctclick wrote: | Thanks everyone for your help, I may do that. Just one other question:
Will always giving emerge a low priority slow things down when I'm not using the computer? Obviously, when I'm not using it, I'd like it to go as fast as possible.
Thanks everyone for you help. |
I can only speak from my own experience:
When I emerge with nice -20 and I don't do anything else, top tells me that emerge (gcc) is taking up all the CPU power. When I need some power for something else It'll get the higher priority.
Basically this is what you want right? |
|
| Back to top |
|
 |
correctclick n00b


Joined: 18 Jul 2002 Posts: 71
|
Posted: Mon Dec 09, 2002 8:25 pm Post subject: |
|
|
Yup, this is what I want. I was going to add a line like this to root's .bashrc
alias emerge='nice -n 19 emerge'
But I was surprised to find that there is no .bashrc! I copied one over from a redhat machine (which is what I used before gentoo), but my gentoo machine doesn't seem to be using it.
Interestingly, my user account, 'tim', does have a .bashrc, but root doesn't.
How can I tell bash to use the .bashrc I just copied to root's home upon each login?
Thanks. |
|
| Back to top |
|
 |
Zr40 Tux's lil' helper

Joined: 19 Sep 2002 Posts: 76
|
Posted: Mon Dec 09, 2002 10:29 pm Post subject: |
|
|
| Try using .bash_profile instead of .bashrc, or put 'source .bashrc' in .bash_profile. |
|
| Back to top |
|
 |
correctclick n00b


Joined: 18 Jul 2002 Posts: 71
|
Posted: Mon Dec 09, 2002 10:46 pm Post subject: |
|
|
| Excellent, that works. Thanks. |
|
| Back to top |
|
 |
Pigeon Guru


Joined: 21 Jun 2002 Posts: 307
|
Posted: Tue Dec 10, 2002 12:26 am Post subject: |
|
|
| .bashrc is only used in terminal shells, and .bash_profile is only used in login shells. Login shells automatically source /etc/profile, but terminal shells do not. Kinda funky. |
|
| Back to top |
|
 |
correctclick n00b


Joined: 18 Jul 2002 Posts: 71
|
Posted: Tue Dec 10, 2002 1:58 am Post subject: |
|
|
Excuse me if I'm ignorant, but why is it a login shell when I'm root and a terminal shell when I'm a user? What's the difference?
Thanks. |
|
| Back to top |
|
 |
simulacrum Tux's lil' helper

Joined: 30 Nov 2002 Posts: 128 Location: St Paul, MN
|
Posted: Tue Dec 10, 2002 3:26 am Post subject: |
|
|
I've maintained a .bashrc for a while over various distros and installs, so mine is a bit developed by now. I also maintain a simple .profile that ensures .bashrc is executed:
if test -f ~/.bashrc; then
. ~/.bashrc
fi |
|
| Back to top |
|
 |
proxy Apprentice


Joined: 20 Apr 2002 Posts: 253 Location: Chantilly, VA
|
Posted: Wed Dec 11, 2002 8:51 am Post subject: |
|
|
or you could just use the gentoo supplied .bashrc and .bash_profile files
| Code: | | cp /etc/skel/.bash* ~ |
it gives you nice coloured terminal output and everything
proxy |
|
| Back to top |
|
 |
lanius Retired Dev


Joined: 08 Dec 2002 Posts: 160
|
Posted: Wed Dec 11, 2002 8:29 pm Post subject: |
|
|
Is there no better possibility to run X or KDE or any WM on a higher default priority, this solution seems a bit clunky  |
|
| Back to top |
|
 |
|