LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   I don't understand the "NICE" command (https://www.linuxquestions.org/questions/linux-newbie-8/i-dont-understand-the-nice-command-701483/)

extendedping 02-01-2009 03:42 PM

I don't understand the "NICE" command
 
I am trying to run a command (to open a Konsole session telnetted to multiple devices) at a higher priority. what is happening is every time I run the command the Konsole opens but only opens a few (there are 9 total that I need) of the sessions and gives a message "interrupted system call". well I don't know quite how to fix this or what the error means but I figured I would try to run the /usr/bin/konsole (in fedora 10) at a higher priority. well my book says that a lower nice value means a higher priority for the process. so in other words if I am getting it, the command "nice -n -10 /bin/Konsole" should run konsole at a higher priority which is what I want to try. perhaps it is doing that I don't know but when I then run ps axl and look at the 5th and 6th columns (PRI and NI) I see the following

[root@feddy10 ~]# ps axl | grep konsole
5 0 5183 1 10 -10 439440 29012 sys_po S<l ? 0:00 /usr/bin/konsole --new-tab -p tabtitle=VL3_1 -e telnet localhost 2020

you can see my pri value is now 10 and my ni is -10. however when I don't run the command starting with nice -n -10 the columns read 20 (pri) and 0 (ni). so shouldn't nice -n -10 command, make the pri value go above 20 (higher) not down to 10 (lower).

so what is actually happening here? I have read on the internet and in my book that starting a command with a nice -n -x (negative value up to -20) should raise the priority of the process and that I should see the priority (pri in the ps command output) up and not down.

help me out please. oh and the command being run is from within gns3 a cisco emulator so I am trying to open multiple telnet session in tabs using /bin/konsole. the complete command run from within the gns3 app is...

nice -n -10 /usr/bin/konsole --new-tab -p tabtitle=%d -e telnet %h %p >/dev/null 2>&1 &

got the command from the gns3 linux documentation, the exact command they give is the above minus the "nice -n -10" which is what I am putting in.

thank you much in advance, it would be great to

1) solve the "interrupted system call" message that pops up when I run the command (which again only opens a few of the connections not all thus defeating the overall command purpose) and


2) regardless of if I can fix the above issue, get a clear answer as to what effect "nice -n +-x command"
should have on that commands priority and how that will be displayed by the ps command.

I know that's a lot but I wanted to provide as much info as I could again thanks much in advance.

extendedping 02-01-2009 03:48 PM

oh also in my fedora 10 I am running the gnome desktop but I know the Konsole is a kd3 app..I don't know if that would be messing things up a bit as well, just thought I'd ask. I would love to simply use the gnome-terminal to open multiple tabs but I am not that advanced would need someone to show me the appropriate commands :(

sundialsvcs 02-01-2009 07:50 PM

Generally, you should never try to run things at a "higher" priority. Instead, "be nice" whenever you can.

The scheduler will endeavor to keep the CPU always as busy as possible. If there's work to be done it will do it. Process priorities come into play when "something's gotta give."

The "nice" command volunteers to run a command at an inferior dispatching priority ... "go ahead, I'll be nice, you can play through if you need to." That's it.

Strange as it may seem: instead of trying to tell the scheduler "what's urgent," help it to identify "what's really not."

chrism01 02-02-2009 01:20 AM

Incidentally
Quote:

Only the superuser may specify a negative increment, or priority increase.
from the man page:

man 2 nice


All times are GMT -5. The time now is 04:33 AM.