Re: one process on 2 cpu's: need info

Andreas Bombe (andreas.bombe@munich.netsurf.de)
Sat, 7 Aug 1999 18:00:25 +0200


On Thu, Aug 05, 1999 at 12:52:57PM -0700, Martin Krzywinski wrote:
>
> I just want to clarify something for myself. I have a bunch of dual
> processor machines. Any one process can occupy only one CPU (the kernel
> does not use two cpus to double the speed...I suppose for a good reason,
> as parallizing would be difficult).

The kernel doesn't know how to parallelize one program. The program
has to do that for itself.

> However, the usage of the cpu's
> switches back and forth between them. CPU#0 is 100% one second and then 0%
> another, while CPU#1 picks up the task. Why is this shuffling?

When the scheduler decides where to run a task, it prefers the CPU it
previously ran on. However, if there is another task already scheduled
on that CPU and another is idle, it will be run there.

I assume you are testing under X and some stat display program. Then
you have 3 programs running: your program, X and the stat program.
Because X has to update the screen after the stat program updates its
display, all three may be running at the same time causing your program
to bounce around.

-- 
    Andreas E. Bombe <andreas.bombe@munich.netsurf.de>
    http://home.pages.de/~andreas.bombe/
RSA 0x886663c9  30 EC 09 73 84 7B 55 83  C4 7A 91 D9 9D C5 4B B0
DSA 0x04880A44 72E5 7031 4414 2EB6 F6B4  4CBD 1181 7032 0488 0A44

- 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/