Re: Stopping CPU Hogs...

Cameron Simpson (cs@zip.com.au)
Thu, 5 Nov 1998 12:12:45 +1100 (EST)


On 5 Nov 1998, in message <3640C23F.7FAC33BE@iegroup.com>
John Fulmer <jfulmer@iegroup.com> wrote:
| Is there a way to keep a process from hogging 100% cpu usage?

Bear in mind that if nothing else wants the CPU, there's nothing wrong
with that!

| One thing
| that has always bugged me is that a process (oh like, hmmmm, NETSCAPE!)
| can grap 100% cpu for a period of time (usually seconds) and grind the
| system to a halt for that period. I'm familiar with niceness levels, but
| it seems that an ill-behaved process can still jerk the system to a halt
| for a few seconds.

You will probably find that's paging delay, not CPU.
Netscape is VERY memory hungry, and will page out other things if they're
idle long enough. (Of course, that's the OS paging them out...)

| Is there a way to say that any one process or thread can only allocate
| x% of the total cpu usage? I would think that a governor of some sort
| make make linux, especially as a desktop, perform much smoother.

I've had some success with

- renicing netscape all the way back to 19; slowa netscape a bit but
supposedly a browser should be mostly I/O bound anyway, and thus
not suffer too much

- tuning the X defaults to reduce the iteration rate
(eg that bloody N icon they spin during fetches)

- stopping every GIF animation (sadly, they don't supply a flag
for "don't animate GIFs", so you have to wait for the whole,
or enough of the, page to load then hit Stop).
Just for the exercise, go visit a GIF anim gallery and try
to use the menus while they're all up and running.
It's educational.

- if you can get away with it, turn off javascript; it's largely
used for those stupid tickertapes

Also, all that animation etc churns lots of data through the X server
to do the drawing, which doesn't help matters. Running netscape on
another box helps here, as at least the X server and browser aren't
fighting for the same RAM. (This is better than you might imagine - you
can trade off with someone else; when browser and display are on the
same box you're guarrenteed they both want resources at the same time;
if you swap with a friend - your CPU runs his browser, his runs yours -
then you have fair odds of non-overlapping use.)

Netscape really doesn't see to believe that you might be doing something else
while browsing.

What you really want is a per-process RSS limit. That way Netscape wouldn't
get to hog the memory and other things would get to stay resident. Netscape
would jerk around a bit, but with a little tuning it'd probably be ok.

--
Cameron Simpson, DoD#743        cs@zip.com.au        http://www.zip.com.au/~cs/

Just because Unix is a multiuser system doesn't mean I want to share it with anybody! - Paul Tomblin, in rec.aviation.military

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/