When I ran this code using gcc,
$ cat eatup.c
#include<stdio.h>
#include<stdlib.h>
int main() {
int i = 0;
while(1) {
i++;
}
}
$
the CPU graph went like this :
I am not sure why there is a cross in the CPU core usage.
I started the run at the rise to the left of the 40 mark, then initially core2 usage rose to 100% but after sometime there was a switch and core1 usage went 100%.
Any subsequent runs have not reproduced the situation. All I get is a single rise
This might be a bit OS dependent (scheduling processes on the cores), but is there anything that could explain why the switch happened (as shown in the first screenshot)? Any guesses?
Turns out these switches are not so uncommon. Here is a screenshot of System Monitor just after bootup (Ubuntu 10.04)