Re: What is the "nice" process state?

Previous thread: Moved OpenBSD router from Network A to Network B and Internet no longer works by Jake Conk on Saturday, October 27, 2007 - 4:11 am. (4 messages)

Next thread: Re: Moved OpenBSD router from Network A to Network B and Internet no longer works by Jake Conk on Saturday, October 27, 2007 - 6:11 am. (1 message)
From: Karel Kulhavy
Date: Saturday, October 27, 2007 - 4:57 am

I am raytraing a video with a command "rt" and the "top" is showing this:

CPU states: 48.4% user, 48.7% nice,  3.0% system,  0.0% interrupt,  0.0% idle
[...]
PID USERNAME PRI NICE  SIZE   RES STATE    WAIT     TIME    CPU COMMAND
29174 clock     79   10   33M   15M run      -        0:00  4.25% rt

What is the "nice" state? I know what userspace, system, interrupt handler
and idle task is, but nice?

CL<

From: Paul de Weerd
Date: Saturday, October 27, 2007 - 5:17 am

On Sat, Oct 27, 2007 at 01:57:06PM +0200, Karel Kulhavy wrote:
| I am raytraing a video with a command "rt" and the "top" is showing this:
|
| CPU states: 48.4% user, 48.7% nice,  3.0% system,  0.0% interrupt,  0.0%
idle
| [...]
| PID USERNAME PRI NICE  SIZE   RES STATE    WAIT     TIME    CPU COMMAND
| 29174 clock     79   10   33M   15M run      -        0:00  4.25% rt
|
| What is the "nice" state? I know what userspace, system, interrupt handler
| and idle task is, but nice?

See the nice(1) and renice(8) manpages for more information.

Cheers,

Paul 'WEiRD' de Weerd

+++++++++++>-]<.>++[<------------>-]<+.--------------.[-]
                 http://www.weirdnet.nl/

[demime 1.01d removed an attachment of type application/pgp-signature]

From: Woodchuck
Date: Saturday, October 27, 2007 - 6:04 am

man 1 nice.
man 1 top.
man 3 sysctl  vide KERN_CPTIME

The nice value is added to the basic priority of a task.  The higher
the "nice", the less likely a task is to get CPU time,  so called
because it is being "nice" to other users.  It's part of an ancient
unix work-around for not having proper prioritized batch queues and
a more versatile scheduler.

The standard joke is that there actually was a user who once
voluntarily ran nice on a time-sharing system.

Top's  48.7% nice here is telling you that the CPU is spending 48.7%
of its time executing tasks that are "niced".  If this includes
processes with negative "nice" values, I do not know; you could
peruse the kernel source or conduct an experiment to discover that,
if you care to.

Dave

From: Lars Noodén
Date: Saturday, October 27, 2007 - 7:26 am

It's an adjustment to scheduling priority:

	http://www.openbsd.org/cgi-bin/man.cgi?query=nice

You can use nice to give a process a higher or lower priority than other
processes when you start the process.  Or you can use renice to do the
same after the program is already started.

	http://www.openbsd.org/cgi-bin/man.cgi?query=renice

Often it's used to slow down a CPU hog running in the background.

Regards
-Lars

From: Darrin Chandler
Date: Saturday, October 27, 2007 - 9:35 am

You've been on this list and using OpenBSD for long enough that you
should be trying things like "man nice", "apropos nice" and "man top"
before asking these kinds of questions. Also, Googling for "unix nice"
also yields plenty of info. If you learn how to find answers to
extremely basic questions on your own using provided documentation it
will save you a lot of time.

-- 
Darrin Chandler            |  Phoenix BSD User Group  |  MetaBUG
dwchandler@stilyagin.com   |  http://phxbug.org/      |  http://metabug.org/
http://www.stilyagin.com/  |  Daemons in the Desert   |  Global BUG Federation

From: Karel Kulhavy
Date: Saturday, November 3, 2007 - 3:45 am

man nice doesn't say what the "nice" state in the top printout is neither
man top says it.

From the replies I got (none of which actually answered my question) it looks
like the "nice" state might be a state where the nice value != 0. Or less than
zero would also make sense. But it could be also that OpenBSD has the nice()
function like some other operating systems for giving up the scheduled time
back to the system and then the nice state might show amount of time

If you have columns in a program printout with a meaning that isn't obvious
obvious - like this one, they should be described in the manual page. It's not
a mistake of the user if they aren't.


From: Lars Noodén
Date: Saturday, November 3, 2007 - 4:40 am

Bug report time.  Manpages are 'easy' to update.

-Lars

From: Karel Kulhavy
Date: Saturday, November 3, 2007 - 6:03 am

I don't think that should be added into man nice. I think it should be added
into man top.


From: Douglas A. Tutty
Date: Saturday, November 3, 2007 - 5:55 am

The 'nice' column should be the nice level.  If its 0, then its not
niced either way.  If its 2 then it has a niceness of 2, if its -2 then
its niceness is -2 which means its not nice to other processes.  Since
the purpose of 'nice' is to adjust the scheduling priority, I don't
think anything keeps track of the amount of time given up this way.

Keep in mind, nice is only for processor scheduling while in userland.
It doesn't affect scheduling of system calls or io.  So a very nice
process can still use up a lot of system resources by hogging disk or
other I/O which itself can end up using CPU cycles.

Doug.

From: Karel Kulhavy
Date: Saturday, November 3, 2007 - 7:29 am

It's clear to me what is the nice column. I asked for the nice state instead
- if you run top, you have a line "CPU state: ...0.0% nice..." - that's the
one I am asking about.


From: Martin Schröder
Date: Saturday, November 3, 2007 - 8:21 am

Go away, troll.

From: Karel Kulhavy
Date: Saturday, November 3, 2007 - 9:20 am

Wrong answer. Cf. Patricia Evans - Controlling People. The definition of troll
includes "with the intention of baiting users into an argumentative response"
which requires knowing a state of a different mind - impossible.

CL<

From: Nick Guenther
Date: Saturday, November 3, 2007 - 11:00 am

and this part just doesn't make sense. and the piece of it that does
make sense is wrong: people can know other people's states of mind,
it's called empathy and communication.

From: Martin Schröder
Date: Saturday, November 3, 2007 - 5:02 pm

Shut the Fuck up. Nobody here will miss you.

From: bofh
Date: Saturday, November 3, 2007 - 9:37 pm

I just read man top.  So, just to confirm, for those without ability
to read the source, or understand it, the nice cpu processor state is
the percentage of time spent on niced processes.  Someone mentioned he
was not sure if it was 1-20, or includes -1 to -20.  From the way the
man page is written, it sounds as if the nice % is any nice != 0
processes.  Just curious if I read it right.


--
"This officer's men seem to follow him merely out of idle curiosity."
-- Sandhurst officer cadet evaluation.
http://www.youtube.com/watch?v=tGvHNNOLnCk

From: Daniel Ouellet
Date: Saturday, November 3, 2007 - 10:28 pm

This question was asked a week ago and got answered:

http://marc.info/?l=openbsd-misc&m=119349072814956&w=2

The full treads is available as well and that's the first hit on google too:

http://www.google.com/search?hl=en&q=%22nice+process%22+%2Bopenbsd&btnG=Google...

From: Jason McIntyre
Date: Saturday, November 3, 2007 - 6:15 am

why would nice(1) describe the output of top(1)?

"neither man top says it" - have you actually read top(1)? it does
document the "NICE" column. it also lists renice(8) in the SEE ALSO
section.

top(1) also mentions the USERNAME column - i wonder if we should use the
top(1) manual page to describe how unix usernames work?

come on, man.

jmc

From: Karel Kulhavy
Date: Saturday, November 3, 2007 - 9:14 am

I don't know - you should ask the one from this mailing list who suggested it

hehe yes, but I am not asking about the NICE column, but about the nice
CPU state :)

CL<

From: Jason McIntyre
Date: Saturday, November 3, 2007 - 10:52 am

i think you're looking for nice(3) and setpriority(2).
jmc

From: Woodchuck
Date: Saturday, November 3, 2007 - 6:22 am

From my ancient answer to you, and I quote:

"Top's  48.7% nice here is telling you that the CPU is spending 48.7%
of its time executing tasks that are "niced".  If this includes
processes with negative "nice" values, I do not know; you could
peruse the kernel source or conduct an experiment to discover that,
if you care to."

I also referred you to two or three relevant man pages.

If that doesn't answer your trolling, disengenuous, never-read-a-manpage,
low-grade, losing, pre/sub-newbie question, then answering your questions
is impossible.

You are not worth further effort, kid.

Previous thread: Moved OpenBSD router from Network A to Network B and Internet no longer works by Jake Conk on Saturday, October 27, 2007 - 4:11 am. (4 messages)

Next thread: Re: Moved OpenBSD router from Network A to Network B and Internet no longer works by Jake Conk on Saturday, October 27, 2007 - 6:11 am. (1 message)