[clug] what passes for entertainment...

Hal Ashburner hal.ashburner at gmail.com
Fri Jun 26 15:36:59 GMT 2009


2009/6/26 Jim Croft <jim.croft at gmail.com>

> bored out of my brain, watching the gnome system monitor to pass the
> time...  as one does...
>
> twin core cpu...  two thin lines...  up and down...  up an down...
>
> ah ha...  a pattern!  when one goes up, the other goes down...
> cool... a cpu playing with itself...
>
> does it actually mean anything?  is it controllable?  can or should
> this be influenced?
>
> jim (contemplating loading another OS just to watch a disk defragment)
>

Why would one go up when the other goes down?
I reckon what you have is a whole bunch of processes running, only one of
which really needs to use the cpu. It gets scheduled on the first, the usage
graph spikes, then it sleeps as it doesn't need the cpu for a bit, something
else then gets scheduled, one of the many processes that doesn't actually
need much cpu, cpu 2 is switching between many such process until it has
your cpu intensive process scheduled on it for a burst until it sleeps.
What process would that be?
I'm betting gnome system monitor.

What happens if you switch to the "Processes" tab
Right click "gnome-system-monitor"
change the priority to very low (push the slider all the way to the right)

how about if you close everything you can? web browser, email client,
terminals. If you want to go further work out how to close nautilus so it
won't come back etc. You can probably kill them using the "Processes" tab.
If you run gnome-system-monitor from a twm session this might be the easiest
way to achieve it.
If you've got more than one partition mounted, unmount something that isn't
/ and run fsck on it and see if that affects things.
How about running a good old fashioned busy loop?
file busy_loop.c :

int main (int argc, char **argv)
{
    while (1) {}
    return 0;
}

compile with
$ gcc -Wall busy_loop.c -o busy_loop
run with
$ ./busy_loop

is this different if we update it to sleep every now and then?

#include <time.h>

int main (int argc, char **argv)
{
    struct timespec timeout;
    timeout.tv_sec = 0;
    timeout.tv_nsec = 99999;
    while(1) {
        int i;
        for (i = 1; i < 1000000; ++i) {
              if ( i % 100000 == 0) {
                  nanosleep(&timeout, NULL);
              }
        }
    }
    return 0;
}

Lots of fun you can have playing with system monitors. :D


More information about the linux mailing list