nice level

nice level

Post by carlo » Tue, 03 Jul 2001 21:40:09



renice

Quote:> How can I change the nice level of a running process.
> I know how to change it when starting the process but
> not when it's still running.

 
 
 

nice level

Post by The.Central.Scrutinizer.wakaw.. » Tue, 03 Jul 2001 23:58:55



>How can I change the nice level of a running process.
>I know how to change it when starting the process but
>not when it's still running.

renice

 
 
 

nice level

Post by Michael Lee Yoh » Wed, 04 Jul 2001 01:01:36


Quote:> How can I change the nice level of a running process.
> I know how to change it when starting the process but
> not when it's still running.

Modern "top"s allow you to re-nice a process.  Run "top", and then use
option "r" to re-nice that unfriendly CPU hogger!

--


Software Developer, Engineering Services
Red Hat, Inc.

 
 
 

nice level

Post by Jean-David Beye » Wed, 04 Jul 2001 02:08:35



> > How can I change the nice level of a running process.
> > I know how to change it when starting the process but
> > not when it's still running.

> Modern "top"s allow you to re-nice a process.  Run "top", and then use
> option "r" to re-nice that unfriendly CPU hogger!

I have a question related to this. I usually run GNOME/Enlightenment,
and if I look at the "top" command, I often see that  

11.8  5.4   8:04 /etc/X11/X -auth /var/gdm/:0.Xauth :0

gobbles up the CPU time, especially if the CPUs are heavily loaded.
The funny thing is that I have only three windows open, and they are
not doing much (background processes hogging using CPUs). This does
not always happen: if I boot up the machine, I can usually go for a
few days before the problem crops up. If I continually move the mouse
on the screen, the CPU time consumed by X drops (until I stop moving
the mouse). But once it happens, it does not seem to go away.

I have been tempted to renice X a little bit (4?), but fear it might
not see mouse movement or clicks when the load is high (and I do not
care when it is low).

--
 .~.  Jean-David Beyer           Registered Linux User 85642.
 /V\                             Registered Machine    73926.
/( )\ Shrewsbury, New Jersey     http://counter.li.org
^^-^^ 1:00pm up 8 days, 15:37, 3 users, load average: 2.31, 2.14, 2.14

 
 
 

nice level

Post by Michael Lee Yoh » Wed, 04 Jul 2001 13:18:55


Quote:> 11.8  5.4   8:04 /etc/X11/X -auth /var/gdm/:0.Xauth :0

> gobbles up the CPU time, especially if the CPUs are heavily loaded.
> The funny thing is that I have only three windows open, and they are
> not doing much (background processes hogging using CPUs). This does

3.8 28.8  74:05 X

X is a particularly finicky program - what I mean is that it's very
particular in drawing your window just like it wants to.  The CPU usage
has everything to do with the way X works - X is a single-threaded
program which draws everything by constantly looping an input queue that
  has commands buffered to show something on the screen.

If you have a blank screen with nothing on it - X will still be
constantly looping to check to see if anything is in the input queue.
If I attach "strace" to the X process itself - it dumps roughly the same
output over and over -

sigreturn()                             = ? (mask now [])
select(256, [1 4 5 8 9 10 11 12 13 14 15 16 17 18 20 21 22 23], NULL,
NULL, {0, 0}) = 0 (Timeout)
read(19, 0x8700e50, 4096)               = -1 EAGAIN (Resource
temporarily unavailable)
writev(19,
[{"\1\2lB\0\0\0\0\'\10\300\1\0\0\0\0\0\0\0\0\0\0\0\0\30\271"..., 32}],
1) = 32
gettimeofday({994133311, 253054}, NULL) = 0
select(256, [1 4 5 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23], NULL,
NULL, {119, 896000}) = 1 (in [19], left {119, 890000})
read(19, ">\0\7\0\'\10\300\1\356\3\200\0016\207\200\1\0\0\206\1\0"...,
4096) = 32
read(19, 0x8700e50, 4096)               = -1 EAGAIN (Resource
temporarily unavailable)
writev(19,
[{"\1\2nB\0\0\0\0\'\10\300\1\0\0\0\0\0\0\0\0\0\0\0\0\30\271"..., 32}],
1) = 32
gettimeofday({994133311, 270449}, NULL) = 0
select(256, [1 4 5 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23], NULL,
NULL, {119, 879000}) = 1 (in [23], left {119, 880000})
read(23, ">\0\7\0*b\240\1!\0\240\1#\0\240\1\\\0\0\0p\0\33\0g\0\6"...,
4096) = 76
read(23, 0x86fe608, 4096)               = -1 EAGAIN (Resource
temporarily unavailable)
writev(23,
[{"\1\2\260\327\0\0\0\0\'\10\300\1\0\0\0\0\0\0\0\0\0\0\0\000"..., 32}],
1) = 32
gettimeofday({994133311, 271043}, NULL) = 0
select(256, [1 4 5 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23], NULL,
NULL, {119, 878000}) = ? ERESTARTNOHAND (To be restarted)

--

Check out the two gettimeofday calls to the kernel:

gettimeofday({994133311, 270449}, NULL) = 0
gettimeofday({994133311, 271043}, NULL) = 0

The difference of 271043 and 270449 microseconds (I don't think it's
nanoseconds but I could be wrong) elapses during each loop cycle.
That's quick - which means that X is using CPU time to check for an
empty buffer - this is NORMAL.

Changing its priority my overrun the queue, depending on your system.
If X can't check and pop the instructions in the buffer, your display
could have some really strange results.  CPU usage is directly reflected
by the processing power in your machine.  My machine averages 3.1% usage
on one of two Pentium III 733MHz processors.

--


Software Developer, Engineering Services
Red Hat, Inc.

 
 
 

nice level

Post by Jean-David Beye » Wed, 04 Jul 2001 17:34:25


Michael Lee Yohe wrote (in part):
Quote:

> > 11.8  5.4   8:04 /etc/X11/X -auth /var/gdm/:0.Xauth :0

> > gobbles up the CPU time, especially if the CPUs are heavily loaded.
> > The funny thing is that I have only three windows open, and they are
> > not doing much (background processes hogging using CPUs). This does

> 3.8 28.8  74:05 X

> X is a particularly finicky program - what I mean is that it's very
> particular in drawing your window just like it wants to.  The CPU usage
> has everything to do with the way X works - X is a single-threaded
> program which draws everything by constantly looping an input queue that
>   has commands buffered to show something on the screen.

> If you have a blank screen with nothing on it - X will still be
> constantly looping to check to see if anything is in the input queue.
> If I attach "strace" to the X process itself - it dumps roughly the same
> output over and over -

[snip]

I supposed it worked something like that, but what I do not understand
is:

1.) If I reboot the machine, then for a few days (usually), X runs at
between 0.3% to about 5% of one CPU (I have two 550MHz Pentium III
CPUs).

2.) After a few days (I do not know if elapsed time has anything to do
with it or not), it starts using more time. If I run a job that hits
the CPUs pretty hard, the %CPU time for X goes up considerably perhaps
as much as 50% of a CPU. Now if the stuff I am running were outputting
to the screen a lot, this would be understandable, but if it is
outputting a line to an xterm every 15 seconds or so, and that is all,
I cannot see why X could not continue to take only, say, 5% of one CPU
instead of 50%.

3.) Once it gets into the "bad mode", its useage never gets back down
under 1% of a CPU. Right now, for instance, when I am not typing, and
Netscape is the only thing running (other than top, which is
re-drawing the screen once every 7 seconds), X is taking 12.4% of a
CPU.

--
 .~.  Jean-David Beyer           Registered Linux User 85642.
 /V\                             Registered Machine    73926.
/( )\ Shrewsbury, New Jersey     http://counter.li.org
^^-^^ 4:25am up 9 days, 7:02, 3 users, load average: 2.07, 2.17, 2.08